Commit a14cc591 authored by Vincent Pelletier's avatar Vincent Pelletier

Dynamicaly add methods FolderMixIn instead of Folder because it's not reloaded...

Dynamicaly add methods FolderMixIn instead of Folder because it's not reloaded and the reloading problem was still present.
Simplify the property filters : use __dict__ instale of dir(), which remove the need to check if the property is defined localy, and '_aq_dynamic' already matches the generic "not x.startswith('_')" rule.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@11877 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent abc7462a
......@@ -1337,12 +1337,11 @@ def makeTreeList(here, form, root_dict, report_path, base_category, depth, unfol
# depend on ERP5Form.
from Products.CMFCore.utils import getToolByName
from Products.ERP5Type.Core.Folder import Folder
from Products.ERP5Type.Core.Folder import FolderMixIn
from ZPublisher.mapply import mapply
method_id_filter_list = [x for x in dir(Folder) if getattr(Folder, x, None) is not None and callable(getattr(Folder, x))]
method_id_filter_list.extend(['_aq_dynamic', ])
candidate_method_id_list = [x for x in dir(SelectionTool) if getattr(SelectionTool, x, None) is not None and callable(getattr(SelectionTool, x)) and not x.startswith('_') and not x.endswith('__roles__') and x not in method_id_filter_list]
method_id_filter_list = [x for x in FolderMixIn.__dict__ if callable(getattr(FolderMixIn, x))]
candidate_method_id_list = [x for x in SelectionTool.__dict__ if callable(getattr(SelectionTool, x)) and not x.startswith('_') and not x.endswith('__roles__') and x not in method_id_filter_list]
for property_id in candidate_method_id_list:
def portal_selection_wrapper(self, wrapper_property_id=property_id, *args, **kw):
......@@ -1354,9 +1353,9 @@ for property_id in candidate_method_id_list:
method = getattr(portal_selection, wrapper_property_id)
return mapply(method, positional=args, keyword=request,
context=self, bind=1)
setattr(Folder, property_id, portal_selection_wrapper)
setattr(FolderMixIn, property_id, portal_selection_wrapper)
security_property_id = '%s__roles__' % (property_id, )
security_property = getattr(SelectionTool, security_property_id, None)
if security_property is not None:
setattr(Folder, security_property_id, security_property)
setattr(FolderMixIn, security_property_id, security_property)
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