Commit 7e0db4b3 authored by Yoshinori Okuji's avatar Yoshinori Okuji

Disable excessive caching. Disable acquisitions to obtain porta types and permissions.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@16548 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 089c3d05
...@@ -682,30 +682,30 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject): ...@@ -682,30 +682,30 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject):
# more cases. Only those portal types which View permission # more cases. Only those portal types which View permission
# is not managed by a workflow and which acquire local # is not managed by a workflow and which acquire local
# roles acquire their permission # roles acquire their permission
def isViewPermissionAcquired(portal_type):
if portal_type:
types_tool = getToolByName(self, 'portal_types') types_tool = getToolByName(self, 'portal_types')
type_definition = getattr(types_tool, portal_type, None) def isViewPermissionAcquired(portal_type):
if type_definition and getattr(type_definition, 'acquire_local_roles', 0): type_definition = types_tool.getTypeInfo(portal_type)
for workflow in wf.getChainFor(portal_type): if getattr(aq_base(type_definition), 'acquire_local_roles', 0):
workflow = getattr(wf, workflow, None) for workflow in wf.getWorkflowsFor(portal_type):
if workflow is not None: if 'View' in getattr(aq_base(workflow), 'permissions', ()):
if 'View' in getattr(workflow, 'permissions', ()):
return 0 return 0
# No workflow manages View and roles are acquired # No workflow manages View and roles are acquired
return 1 return 1
return 0 return 0
isViewPermissionAcquired = CachingMethod(isViewPermissionAcquired, # This below is commented out, because caching has tremendous
id='CatalogTool_isViewPermissionAcquired', # side effect, and the performance seems to be not so different. -yo
cache_factory='erp5_content_long') #
# isViewPermissionAcquired = CachingMethod(isViewPermissionAcquired,
# id='CatalogTool_isViewPermissionAcquired',
# cache_factory='erp5_content_long')
# Find the parent definition for security # Find the parent definition for security
document_object = aq_inner(object) document_object = aq_inner(object)
is_acquired = 0 is_acquired = 0
w = IndexableObjectWrapper(vars, document_object) w = IndexableObjectWrapper(vars, document_object)
while getattr(document_object, 'isRADContent', 0): while getattr(document_object, 'isRADContent', 0):
if isViewPermissionAcquired(getattr(document_object, 'portal_type', None)): if isViewPermissionAcquired(getattr(aq_base(document_object), 'portal_type', None)):
document_object = document_object.aq_parent document_object = document_object.aq_parent
is_acquired = 1 is_acquired = 1
else: else:
......
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