Commit 3234cf19 authored by Jérome Perrin's avatar Jérome Perrin

cache path of TypeInformation objects, not objects themselves (for allowedContentType)


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@6198 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent ad775741
...@@ -644,17 +644,19 @@ be a problem).""" ...@@ -644,17 +644,19 @@ be a problem)."""
def compareTypes(a, b): return cmp(a.title or a.id, b.title or b.id) def compareTypes(a, b): return cmp(a.title or a.id, b.title or b.id)
type_list = CMFBTreeFolder.allowedContentTypes(self) type_list = CMFBTreeFolder.allowedContentTypes(self)
type_list.sort(compareTypes) type_list.sort(compareTypes)
return type_list return ['/'.join(x.getPhysicalPath()) for x in type_list]
_allowedContentTypes = CachingMethod( _allowedContentTypes, _allowedContentTypes = CachingMethod( _allowedContentTypes,
id = 'allowedContentTypes', id = 'allowedContentTypes',
cache_duration = 300) cache_duration = 300)
user = str(_getAuthenticatedUser(self)) user = str(_getAuthenticatedUser(self))
portal_type = self.getPortalType() portal_type = self.getPortalType()
portal_path = self.getPortalObject().getPhysicalPath() portal = self.getPortalObject()
return _allowedContentTypes( portal_type = portal_type, portal_path = portal.getPhysicalPath()
user = user, return [portal.restrictedTraverse(path) for path in
portal_path = portal_path ) _allowedContentTypes( portal_type = portal_type,
user = user,
portal_path = portal_path )]
# Multiple Inheritance Priority Resolution # Multiple Inheritance Priority Resolution
_setProperty = Base._setProperty _setProperty = Base._setProperty
......
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