pyldb: Fix dn concat operation to be the other way around
authorAndrew Bartlett <abartlet@samba.org>
Fri, 6 Jul 2012 10:41:10 +0000 (20:41 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 6 Jul 2012 12:45:33 +0000 (22:45 +1000)
This now concatonates Dn(ldb, "cn=config") + Dn(ldb, "dc=samba,dc=org") as "cn=config,dc=samba,dc=org"

Andrew Bartlett

lib/ldb/pyldb.c
lib/ldb/tests/python/api.py

index 4554886e8da0a9eccdf6e436c5b80502e9359395..9c8a70b5292401823288be969fbef71cc0d3b8c5 100644 (file)
@@ -629,7 +629,7 @@ static PyObject *py_ldb_dn_concat(PyLdbDnObject *self, PyObject *py_other)
        }
        py_ret->mem_ctx = talloc_new(NULL);
        py_ret->dn = ldb_dn_copy(py_ret->mem_ctx, dn);
-       ldb_dn_add_child(py_ret->dn, other);
+       ldb_dn_add_base(py_ret->dn, other);
        return (PyObject *)py_ret;
 }
 
index 7cd8f0364e88969fdacca60dde2e8102cd6f814a..d04d0cc5ed636d3f8a37b2b9d3d99e64b7b1308e 100755 (executable)
@@ -414,7 +414,7 @@ class DnTests(TestCase):
     def test_add(self):
         x = ldb.Dn(self.ldb, "dc=foo24")
         y = ldb.Dn(self.ldb, "bar=bla")
-        self.assertEquals("dc=foo24,bar=bla", str(y + x))
+        self.assertEquals("dc=foo24,bar=bla", str(x + y))
 
     def test_parse_ldif(self):
         msgs = self.ldb.parse_ldif("dn: foo=bar\n")