summaryrefslogtreecommitdiff
path: root/source4/scripting/swig/Ldb.py
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2006-04-04 22:15:27 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:00:16 -0500
commit9956009a41f2489abefa0a7a21553fb0b78e1fed (patch)
tree8812f70922bfd5620d740a2b5f7550e6f6b26faa /source4/scripting/swig/Ldb.py
parent1385cd968bf94dd9b9b252bc679667568845c682 (diff)
downloadsamba-9956009a41f2489abefa0a7a21553fb0b78e1fed.tar.gz
samba-9956009a41f2489abefa0a7a21553fb0b78e1fed.tar.bz2
samba-9956009a41f2489abefa0a7a21553fb0b78e1fed.zip
r14915: Work in progress - getting ldb_add() working.
(This used to be commit d50661ed4ef3f6c96811649a1acbe5d702e80654)
Diffstat (limited to 'source4/scripting/swig/Ldb.py')
-rw-r--r--source4/scripting/swig/Ldb.py22
1 files changed, 14 insertions, 8 deletions
diff --git a/source4/scripting/swig/Ldb.py b/source4/scripting/swig/Ldb.py
index 995f421beb..f761aec398 100644
--- a/source4/scripting/swig/Ldb.py
+++ b/source4/scripting/swig/Ldb.py
@@ -44,14 +44,20 @@ class LdbElement:
class LdbMessage:
"""A class representing a ldb message as a dict of ldb elements."""
- def __init__(self, msg):
- self.dn = msg.dn
- self.private_data = msg.private_data
- eltlist = \
- [LdbElement(ldb.ldb_message_element_array_getitem(msg.elements, x))
- for x in range(msg.num_elements)]
- self.elements = \
- dict([(x.name, x) for x in eltlist])
+ def __init__(self, msg = None):
+
+ self.dn = None
+ self.private_data = None
+ self.elements = []
+
+ if msg is not None:
+ self.dn = msg.dn
+ self.private_data = msg.private_data
+ eltlist = \
+ [LdbElement(ldb.ldb_message_element_array_getitem(
+ msg.elements, x))
+ for x in range(msg.num_elements)]
+ self.elements = dict([(x.name, x) for x in eltlist])
def __repr__(self):
return '<%s(dn=%s) instance at 0x%x>' % (self.__class__.__name__,