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

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Oct 14 13:46:51 CEST 2009


Author: kazuhiko
Date: Wed Oct 14 13:46:50 2009
New Revision: 29644

URL: http://svn.erp5.org?rev=29644&view=rev
Log:
call 'updateLocalRolesOnDocument()' only if any role exists on the document.

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=29644&r1=29643&r2=29644&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/ERP5Type.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/ERP5Type.py [utf8] Wed Oct 14 13:46:50 2009
@@ -392,7 +392,12 @@
           # workflow and it is annoyning without security setted
           ob.portal_type = self.getId()
 
-        self.updateLocalRolesOnDocument(ob)
+        # Here we don't use "if len(self.getFilteredRoleListFor(ob))"
+        # but use "for role in self.getFilteredRoleListFor(ob)" because
+        # getFilteredRoleListFor returns a generator.
+        for role in self.getFilteredRoleListFor(ob):
+          self.updateLocalRolesOnDocument(ob)
+          break
 
         # notify workflow after generating local roles, in order to prevent
         # Unauthorized error on transition's condition




More information about the Erp5-report mailing list