Commit e748ae24 authored by Jean-Paul Smets's avatar Jean-Paul Smets

Make this cache safer for objects with no portal type definition.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@10508 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 4d9e0a63
...@@ -2130,7 +2130,17 @@ class Base( CopyContainer, ...@@ -2130,7 +2130,17 @@ class Base( CopyContainer,
The code to support this is in the user folder. The code to support this is in the user folder.
""" """
def cashed_getAcquireLocalRoles(portal_type): 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, cashed_getAcquireLocalRoles = CachingMethod(cashed_getAcquireLocalRoles,
id='Base__getAcquireLocalRoles') id='Base__getAcquireLocalRoles')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment