diff options
| author | Jelmer Vernooij <jelmer@samba.org> | 2008-01-11 16:13:46 +0100 |
|---|---|---|
| committer | Jelmer Vernooij <jelmer@samba.org> | 2008-01-11 16:13:46 +0100 |
| commit | 7c3e8c838f0ada9ebae9dbb2bc5d84320c8431f2 (patch) | |
| tree | b12fcf2bbc50e111e10c101f199749459e65f4a1 /source4/scripting/python/samba/__init__.py | |
| parent | 35c597161b8af4b39e2c99b35b6782010b3dcb78 (diff) | |
| download | samba-7c3e8c838f0ada9ebae9dbb2bc5d84320c8431f2.tar.gz samba-7c3e8c838f0ada9ebae9dbb2bc5d84320c8431f2.tar.bz2 samba-7c3e8c838f0ada9ebae9dbb2bc5d84320c8431f2.zip | |
Python: Simplify code in a couple of places. Copy Andrew's changes from g53b5166.
(This used to be commit f056f624958af79204c972eba3f85e36e93daed7)
Diffstat (limited to 'source4/scripting/python/samba/__init__.py')
| -rw-r--r-- | source4/scripting/python/samba/__init__.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/source4/scripting/python/samba/__init__.py b/source4/scripting/python/samba/__init__.py index e0b9e1d4104..e8581801692 100644 --- a/source4/scripting/python/samba/__init__.py +++ b/source4/scripting/python/samba/__init__.py @@ -112,15 +112,15 @@ class Ldb(ldb.Ldb): for attr in ["@INDEXLIST", "@ATTRIBUTES", "@SUBCLASSES", "@MODULES", "@OPTIONS", "@PARTITION", "@KLUDGEACL"]: try: - self.delete(ldb.Dn(self, attr)) + self.delete(attr) except ldb.LdbError, (LDB_ERR_NO_SUCH_OBJECT, _): # Ignore missing dn errors pass - basedn = ldb.Dn(self, "") + basedn = "" # and the rest for msg in self.search(basedn, ldb.SCOPE_SUBTREE, - "(&(|(objectclass=*)(dn=*))(!(dn=@BASEINFO)))", + "(&(|(objectclass=*)(distinguishedName=*))(!(distinguishedName=@BASEINFO)))", ["dn"]): try: self.delete(msg.dn) @@ -128,12 +128,12 @@ class Ldb(ldb.Ldb): # Ignor eno such object errors pass - res = self.search(basedn, ldb.SCOPE_SUBTREE, "(&(|(objectclass=*)(dn=*))(!(dn=@BASEINFO)))", ["dn"]) + res = self.search(basedn, ldb.SCOPE_SUBTREE, "(&(|(objectclass=*)(distinguishedName=*))(!(distinguisedName=@BASEINFO)))", ["dn"]) assert len(res) == 0 def erase_partitions(self): """Erase an ldb, removing all records.""" - res = self.search(ldb.Dn(self, ""), ldb.SCOPE_BASE, "(objectClass=*)", + res = self.search("", ldb.SCOPE_BASE, "(objectClass=*)", ["namingContexts"]) assert len(res) == 1 if not "namingContexts" in res[0]: @@ -145,7 +145,7 @@ class Ldb(ldb.Ldb): k = 0 while ++k < 10 and (previous_remaining != current_remaining): # and the rest - res2 = self.search(ldb.Dn(self, basedn), ldb.SCOPE_SUBTREE, "(|(objectclass=*)(dn=*))", ["dn"]) + res2 = self.search(basedn, ldb.SCOPE_SUBTREE, "(|(objectclass=*)(distinguishedName=*))", ["distinguishedName"]) previous_remaining = current_remaining current_remaining = len(res2) for msg in res2: |
