diff options
author | Tim Potter <tpot@samba.org> | 2006-04-03 08:03:44 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:00:11 -0500 |
commit | 574c9fd6854b743b8727af5f53cc184552446e4d (patch) | |
tree | 5c4d13e744ab1891ab9c29504b0c04415be8efa5 /source4/scripting/swig/Ldb.py | |
parent | 6d98076c15e8726606da0a99714cd3382d82f9ac (diff) | |
download | samba-574c9fd6854b743b8727af5f53cc184552446e4d.tar.gz samba-574c9fd6854b743b8727af5f53cc184552446e4d.tar.bz2 samba-574c9fd6854b743b8727af5f53cc184552446e4d.zip |
r14878: Write swig wrappers for ldb_init() and ldb_connect().
Start wrapper for ldb_search(). Currently it returns a list of swig
ldb_message objects. More unpacking of results required.
(This used to be commit 704787978aa705edba233249e8eab236ffe303a4)
Diffstat (limited to 'source4/scripting/swig/Ldb.py')
-rw-r--r-- | source4/scripting/swig/Ldb.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/source4/scripting/swig/Ldb.py b/source4/scripting/swig/Ldb.py index fe105bdb09..705a790fef 100644 --- a/source4/scripting/swig/Ldb.py +++ b/source4/scripting/swig/Ldb.py @@ -23,4 +23,17 @@ import ldb class Ldb: - pass + + def __init__(self): + self.mem_ctx = ldb.talloc_init('python ldb') + self.ldb_ctx = ldb.init(self.mem_ctx) + + def __del__(self): + ldb.talloc_free(self.mem_ctx) + + def connect(self, url, flags = 0): + ldb.connect(self.ldb_ctx, url, flags, None) + + def search(self, expression): + return ldb.search(self.ldb_ctx, None, ldb.LDB_SCOPE_DEFAULT, + expression, None); |