[Erp5-report] r11877 - /erp5/trunk/products/ERP5Form/SelectionTool.py

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Jan 3 16:12:23 CET 2007


Author: vincent
Date: Wed Jan  3 16:12:21 2007
New Revision: 11877

URL: http://svn.erp5.org?rev=11877&view=rev
Log:
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.

Modified:
    erp5/trunk/products/ERP5Form/SelectionTool.py

Modified: erp5/trunk/products/ERP5Form/SelectionTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Form/SelectionTool.py?rev=11877&r1=11876&r2=11877&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Form/SelectionTool.py (original)
+++ erp5/trunk/products/ERP5Form/SelectionTool.py Wed Jan  3 16:12:21 2007
@@ -1337,12 +1337,11 @@
 # 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 @@
     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)
+




More information about the Erp5-report mailing list