[Erp5-report] r38412 jerome - /erp5/trunk/products/ERP5Type/Accessor/Base.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Sep 16 11:49:25 CEST 2010


Author: jerome
Date: Thu Sep 16 11:49:24 2010
New Revision: 38412

URL: http://svn.erp5.org?rev=38412&view=rev
Log:
sometimes the class defined permission is None, sometimes it's a proper
permissionRole (when security.declareProtected has been used). The later was
not supported by 38378. It was the cause of cryptic "TypeError: iterable
argument required" that occured in some tests.

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

Modified: erp5/trunk/products/ERP5Type/Accessor/Base.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Accessor/Base.py?rev=38412&r1=38411&r2=38412&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Accessor/Base.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/Accessor/Base.py [utf8] Thu Sep 16 11:49:24 2010
@@ -36,6 +36,7 @@ from zLOG import LOG
 from Products.ERP5Type.Cache import CachingMethod
 from Products.ERP5Type.PsycoWrapper import psyco
 from AccessControl.ImplPython import rolesForPermissionOn
+from AccessControl.PermissionRole import PermissionRole
 
 # Creation of default constructor
 class func_code: pass
@@ -117,6 +118,8 @@ class Setter(Method):
             # security on the class for generated methods.
             class_role = getattr(im_self.__class__, name, im_self)
             if class_role is not im_self:
+                if isinstance(class_role, PermissionRole):
+                    return class_role.__of__(im_self)
                 return class_role
             return rolesForPermissionOn(None, im_self, ('Manager',),
                                         '_Modify_portal_content_Permission')
@@ -199,6 +202,8 @@ class Getter(Method):
         if roles is None:
             class_role = getattr(im_self.__class__, name, im_self)
             if class_role is not im_self:
+                if isinstance(class_role, PermissionRole):
+                    return class_role.__of__(im_self)
                 return class_role
             return rolesForPermissionOn(None, im_self, ('Manager',),
                                         '_Access_contents_information_Permission')




More information about the Erp5-report mailing list