[Erp5-report] r10508 - /erp5/trunk/products/ERP5Type/Base.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Tue Oct 3 14:04:03 CEST 2006
Author: jp
Date: Tue Oct 3 14:04:00 2006
New Revision: 10508
URL: http://svn.erp5.org?rev=10508&view=rev
Log:
Make this cache safer for objects with no portal type definition.
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=10508&r1=10507&r2=10508&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Base.py (original)
+++ erp5/trunk/products/ERP5Type/Base.py Tue Oct 3 14:04:00 2006
@@ -2130,7 +2130,17 @@
The code to support this is in the user folder.
"""
def cashed_getAcquireLocalRoles(portal_type):
- return self._getTypesTool()[self.getPortalType()].acquire_local_roles
+ 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,
id='Base__getAcquireLocalRoles')
More information about the Erp5-report
mailing list