summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/ldb.i
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-01-11 01:55:56 +0100
committerJelmer Vernooij <jelmer@samba.org>2008-01-11 01:55:56 +0100
commit2466d2cc5e210a124bb23cb9d2c8d3cc608a7c7f (patch)
treef02c25c7fff97af57ccfc6f47362b5acaef0d587 /source4/lib/ldb/ldb.i
parentc3695026e1cfac3e835e937ed9343d82500cf197 (diff)
downloadsamba-2466d2cc5e210a124bb23cb9d2c8d3cc608a7c7f.tar.gz
samba-2466d2cc5e210a124bb23cb9d2c8d3cc608a7c7f.tar.bz2
samba-2466d2cc5e210a124bb23cb9d2c8d3cc608a7c7f.zip
ldb/python: Allow comparing a MessageElement to a list or a singleton.
(This used to be commit 1ccbab81d79f83bb419104f2bbaf2ae7b368e90f)
Diffstat (limited to 'source4/lib/ldb/ldb.i')
-rw-r--r--source4/lib/ldb/ldb.i13
1 files changed, 8 insertions, 5 deletions
diff --git a/source4/lib/ldb/ldb.i b/source4/lib/ldb/ldb.i
index 57fa36584e..b6718351f8 100644
--- a/source4/lib/ldb/ldb.i
+++ b/source4/lib/ldb/ldb.i
@@ -306,12 +306,15 @@ typedef struct ldb_message_element {
return ret
def __eq__(self, other):
- if (isinstance(other, str) and
- len(set(self)) == 1 and
- set(self).pop() == other):
+ if (len(self) == 1 and self.get(0) == other):
return True
- return self.__cmp__(other) == 0
-
+ if isinstance(other, self.__class__):
+ return self.__cmp__(other) == 0
+ o = iter(other)
+ for i in range(len(self)):
+ if self.get(i) != o.next():
+ return False
+ return True
}
} ldb_msg_element;