[Erp5-report] r30331 - /erp5/trunk/products/ERP5Type/ERP5Type.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Nov 5 12:01:30 CET 2009


Author: jm
Date: Thu Nov  5 12:01:28 2009
New Revision: 30331

URL: http://svn.erp5.org?rev=30331&view=rev
Log:
Speed up 'ERP5TypeInformation.updateLocalRolesOnDocument'

Modified:
    erp5/trunk/products/ERP5Type/ERP5Type.py

Modified: erp5/trunk/products/ERP5Type/ERP5Type.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/ERP5Type.py?rev=30331&r1=30330&r2=30331&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/ERP5Type.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/ERP5Type.py [utf8] Thu Nov  5 12:01:28 2009
@@ -72,17 +72,15 @@
       group_id_role_dict = self.getLocalRolesFor(ob, user_name)
 
       ## Update role assignments to groups
-      # Clean old group roles
-      old_group_list = ob.get_local_roles()
-      ob.manage_delLocalRoles([x[0] for x in old_group_list])
       # Save the owner
-      for group, role_list in old_group_list:
+      for group, role_list in (ob.__ac_local_roles__ or {}).iteritems():
         if 'Owner' in role_list:
           group_id_role_dict.setdefault(group, set()).add('Owner')
       # Assign new roles
+      ob.__ac_local_roles__ = ac_local_roles = {}
       for group, role_list in group_id_role_dict.iteritems():
         if role_list:
-          ob.manage_addLocalRoles(group, role_list)
+          ac_local_roles[group] = list(role_list)
       ## Make sure that the object is reindexed
       if reindex:
         ob.reindexObjectSecurity()




More information about the Erp5-report mailing list