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

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Oct 11 10:12:21 CEST 2006


Author: jerome
Date: Wed Oct 11 10:12:18 2006
New Revision: 10645

URL: http://svn.erp5.org?rev=10645&view=rev
Log:
make _getAcquireLocalRoles more robust for documents whose type information is
not an ERP5TypeInformation.


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

Modified: erp5/trunk/products/ERP5Type/Base.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Base.py?rev=10645&r1=10644&r2=10645&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Base.py (original)
+++ erp5/trunk/products/ERP5Type/Base.py Wed Oct 11 10:12:18 2006
@@ -2122,29 +2122,22 @@
     return None
 
   def _getAcquireLocalRoles(self):
-    """
-    This methods the value of acquire_local_roles of the object's portal_type
-    True means, local roles are acquired, which is the standard behavior of
-    Zope objects. False means that the role acquisition chain is cut.
-
-    The code to support this is in the user folder.
-    """
-    def cashed_getAcquireLocalRoles(portal_type):
-      types_tool = self._getTypesTool()
-      portal_type = self.getPortalType()
-      if hasattr(types_tool, portal_type):
-        # Property is defined on a portal type	      
-        return types_tool[portal_type].acquire_local_roles
-      else:
-        # Default behaviour for objects with not portal type definition
-        # ex. SyncML Subscription
-        # XXX - not sure if raising an error would not be better
-        # since this kind of behaviour should not exist
-        return 1
-
-    cashed_getAcquireLocalRoles = CachingMethod(cashed_getAcquireLocalRoles,
+    """This method returns the value of acquire_local_roles of the object's
+    portal_type.
+      - True means local roles are acquired, which is the standard behavior of
+      Zope objects.
+      - False means that the role acquisition chain is cut.
+
+    The code to support this is in the user folder, see
+    patches/PropertiedUser.py
+    """
+    def cached_getAcquireLocalRoles(portal_type):
+      ti = self._getTypesTool().getTypeInfo(self)
+      return getattr(ti, 'acquire_local_roles', True)
+
+    cached_getAcquireLocalRoles = CachingMethod(cached_getAcquireLocalRoles,
                                                 id='Base__getAcquireLocalRoles')
-    return cashed_getAcquireLocalRoles(portal_type=self.getPortalType())
+    return cached_getAcquireLocalRoles(portal_type=self.getPortalType())
 
   security.declareProtected(Permissions.View, 'get_local_permissions')
   def get_local_permissions(self):




More information about the Erp5-report mailing list