From 94e06fe2032b0143939abd85044b5c3ccddefe70 Mon Sep 17 00:00:00 2001
From: Jelmer Vernooij <jelmer@samba.org>
Date: Sun, 20 Jun 2010 02:32:23 +0200
Subject: Some more formatting fixes, move schema related functions from Ldb to
 Schema.

---
 source4/scripting/python/samba/samdb.py | 26 +++++++++++++++-----------
 1 file changed, 15 insertions(+), 11 deletions(-)

(limited to 'source4/scripting/python/samba/samdb.py')

diff --git a/source4/scripting/python/samba/samdb.py b/source4/scripting/python/samba/samdb.py
index a47db9680ad..0a3ca41604a 100644
--- a/source4/scripting/python/samba/samdb.py
+++ b/source4/scripting/python/samba/samdb.py
@@ -150,7 +150,7 @@ pwdLastSet: 0
         else:
             self.transaction_commit()
 
-    def deletegroup (self, groupname):
+    def deletegroup(self, groupname):
         """Deletes a group
 
         :param groupname: Name of the target group
@@ -162,19 +162,16 @@ pwdLastSet: 0
             targetgroup = self.search(base=self.domain_dn(), scope=ldb.SCOPE_SUBTREE,
                                expression=groupfilter, attrs=[])
             if len(targetgroup) == 0:
-                print('Unable to find group "%s"' % (groupname or expression))
-                raise
+                raise Exception('Unable to find group "%s"' % groupname)
             assert(len(targetgroup) == 1)
-
-            self.delete (targetgroup[0].dn);
-
+            self.delete(targetgroup[0].dn);
         except:
             self.transaction_cancel()
             raise
         else:
             self.transaction_commit()
 
-    def add_remove_group_members (self, groupname, listofmembers,
+    def add_remove_group_members(self, groupname, listofmembers,
                                   add_members_operation=True):
         """Adds or removes group members
 
@@ -191,8 +188,7 @@ pwdLastSet: 0
             targetgroup = self.search(base=self.domain_dn(), scope=ldb.SCOPE_SUBTREE,
                                expression=groupfilter, attrs=['member'])
             if len(targetgroup) == 0:
-                print('Unable to find group "%s"' % (groupname or expression))
-                raise
+                raise Exception('Unable to find group "%s"' % groupname)
             assert(len(targetgroup) == 1)
 
             modified = False
@@ -364,8 +360,7 @@ member: %s
             res = self.search(base=self.domain_dn(), scope=ldb.SCOPE_SUBTREE,
                               expression=filter, attrs=[])
             if len(res) == 0:
-                print('Unable to find user "%s"' % (username or filter))
-                raise
+                raise Exception('Unable to find user "%s"' % (username or filter))
             assert(len(res) == 1)
             user_dn = res[0].dn
 
@@ -480,3 +475,12 @@ accountExpires: %u
 
     def load_partition_usn(self, base_dn):
         return dsdb.dsdb_load_partition_usn(self, base_dn)
+
+    def set_schema(self, schema):
+        self.set_schema_from_ldb(schema.ldb)
+
+    def set_schema_from_ldb(self, ldb):
+        dsdb.dsdb_set_schema_from_ldb(self, ldb)
+
+    def write_prefixes_from_schema(self):
+        dsdb.dsdb_write_prefixes_from_schema_to_ldb(self)
-- 
cgit