Changed ldb.ERR_NO_SUCH_OBJECT to LDB_ERR_NO_SUCH_OBJECT.
authorAndrew Tridgell <tridge@samba.org>
Thu, 2 Jul 2009 04:52:25 +0000 (14:52 +1000)
committerAndrew Tridgell <tridge@samba.org>
Thu, 2 Jul 2009 04:55:38 +0000 (14:55 +1000)
The LDB_ERR_NO_SUCH_OBJECT varient is not a defined variable. This
should improve error handling in our python code on some
systems. Unfortunately it still doesn't work on mine. I need to trap
Jelmer somewhere where he can't escape some day and force him to
divulge the deep druid secrets of python exception handling ....

source4/scripting/python/samba/__init__.py

index f93b0eda6046f378123e33ee83b820f4c9d93cd0..60a7919136548dc967a1ef44d98581b69cdd7cc1 100644 (file)
@@ -125,7 +125,7 @@ class Ldb(ldb.Ldb):
                      "@OPTIONS", "@PARTITION", "@KLUDGEACL"]:
             try:
                 self.delete(attr)
-            except ldb.LdbError, (LDB_ERR_NO_SUCH_OBJECT, _):
+            except ldb.LdbError, (ldb.ERR_NO_SUCH_OBJECT, _):
                 # Ignore missing dn errors
                 pass
 
@@ -136,7 +136,7 @@ class Ldb(ldb.Ldb):
                 ["distinguishedName"]):
             try:
                 self.delete(msg.dn)
-            except ldb.LdbError, (LDB_ERR_NO_SUCH_OBJECT, _):
+            except ldb.LdbError, (ldb.ERR_NO_SUCH_OBJECT, _):
                 # Ignore no such object errors
                 pass
 
@@ -159,7 +159,7 @@ class Ldb(ldb.Ldb):
                 # and the rest
                 try:
                     res2 = self.search(basedn, ldb.SCOPE_SUBTREE, "(|(objectclass=*)(distinguishedName=*))", ["distinguishedName"])
-                except ldb.LdbError, (LDB_ERR_NO_SUCH_OBJECT, _):
+                except ldb.LdbError, (ldb.ERR_NO_SUCH_OBJECT, _):
                     # Ignore missing dn errors
                     return
 
@@ -169,10 +169,10 @@ class Ldb(ldb.Ldb):
                     try:
                         self.delete(msg.dn)
                     # Ignore no such object errors
-                    except ldb.LdbError, (LDB_ERR_NO_SUCH_OBJECT, _):
+                    except ldb.LdbError, (ldb.ERR_NO_SUCH_OBJECT, _):
                         pass
                     # Ignore not allowed on non leaf errors
-                    except ldb.LdbError, (LDB_ERR_NOT_ALLOWED_ON_NON_LEAF, _):
+                    except ldb.LdbError, (ldb.ERR_NOT_ALLOWED_ON_NON_LEAF, _):
                         pass
 
     def load_ldif_file_add(self, ldif_path):