summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/ldb.py
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-01-11 04:05:41 +0100
committerJelmer Vernooij <jelmer@samba.org>2008-01-11 04:05:41 +0100
commit79d466c37397a9d3d236f1c81d7d7fda479bd052 (patch)
tree81b950ab72ca50df243091bd4b0c8e5842669119 /source4/lib/ldb/ldb.py
parentc01396dc2454f978bc4a2d1a81bb357de64732b3 (diff)
downloadsamba-79d466c37397a9d3d236f1c81d7d7fda479bd052.tar.gz
samba-79d466c37397a9d3d236f1c81d7d7fda479bd052.tar.bz2
samba-79d466c37397a9d3d236f1c81d7d7fda479bd052.zip
ldb/python: Support comparing Dn's to strings.
(This used to be commit 355878907970b396e4031426fda260d981c417eb)
Diffstat (limited to 'source4/lib/ldb/ldb.py')
-rw-r--r--source4/lib/ldb/ldb.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/source4/lib/ldb/ldb.py b/source4/lib/ldb/ldb.py
index 4cc8b5268a..ab2a68a4b3 100644
--- a/source4/lib/ldb/ldb.py
+++ b/source4/lib/ldb/ldb.py
@@ -71,6 +71,13 @@ class Dn(object):
def __init__(self, *args, **kwargs):
_ldb.Dn_swiginit(self,_ldb.new_Dn(*args, **kwargs))
__swig_destroy__ = _ldb.delete_Dn
+ def __eq__(self, other):
+ if isinstance(other, self.__class__):
+ return self.__cmp__(other) == 0
+ if isinstance(other, str):
+ return str(self) == other
+ return False
+
Dn.validate = new_instancemethod(_ldb.Dn_validate,None,Dn)
Dn.get_casefold = new_instancemethod(_ldb.Dn_get_casefold,None,Dn)
Dn.__str__ = new_instancemethod(_ldb.Dn___str__,None,Dn)