svn commit: samba r25651 - in branches/4.0-python: .
source/lib/ldb/swig source/lib/ldb/tests/python
jelmer at samba.org
jelmer at samba.org
Mon Oct 15 13:29:06 GMT 2007
Author: jelmer
Date: 2007-10-15 13:29:05 +0000 (Mon, 15 Oct 2007)
New Revision: 25651
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=25651
Log:
Support <dn> in <ldb> syntax.
Modified:
branches/4.0-python/
branches/4.0-python/source/lib/ldb/swig/ldb.i
branches/4.0-python/source/lib/ldb/tests/python/api.py
Changeset:
Property changes on: branches/4.0-python
___________________________________________________________________
Name: bzr:revision-info
...skipped...
Name: bzr:revision-id:v3-trunk0
...skipped...
Modified: branches/4.0-python/source/lib/ldb/swig/ldb.i
===================================================================
--- branches/4.0-python/source/lib/ldb/swig/ldb.i 2007-10-15 13:29:02 UTC (rev 25650)
+++ branches/4.0-python/source/lib/ldb/swig/ldb.i 2007-10-15 13:29:05 UTC (rev 25651)
@@ -301,6 +301,20 @@
ldb_error transaction_start();
ldb_error transaction_commit();
ldb_error transaction_cancel();
+
+#ifdef SWIGPYTHON
+ bool __contains__(ldb_dn *dn)
+ {
+ struct ldb_result *result;
+
+ int ret = ldb_search($self, dn, LDB_SCOPE_BASE, NULL, NULL,
+ &result);
+
+ /* FIXME: Check ret and set exception if necessary */
+
+ return result->count > 0;
+ }
+#endif
}
} ldb;
Modified: branches/4.0-python/source/lib/ldb/tests/python/api.py
===================================================================
--- branches/4.0-python/source/lib/ldb/tests/python/api.py 2007-10-15 13:29:02 UTC (rev 25650)
+++ branches/4.0-python/source/lib/ldb/tests/python/api.py 2007-10-15 13:29:05 UTC (rev 25651)
@@ -32,6 +32,17 @@
l = ldb.Ldb("foo.tdb")
self.assertRaises(RuntimeError, lambda: l.delete(ldb.Dn(l, "dc=foo")))
+ def test_contains(self):
+ l = ldb.Ldb("foo.tdb")
+ self.assertFalse(ldb.Dn(l, "dc=foo") in l)
+ l = ldb.Ldb("foo.tdb")
+ m = ldb.Message()
+ m.dn = ldb.Dn(l, "dc=foo")
+ m["b"] = "a"
+ l.add(m)
+ self.assertTrue(ldb.Dn(l, "dc=foo") in l)
+ l.delete(m.dn)
+
def test_get_config_basedn(self):
l = ldb.Ldb("foo.tdb")
self.assertEquals(None, l.get_config_basedn())
More information about the samba-cvs
mailing list