[Erp5-report] r44185 vincent - /erp5/trunk/products/ERP5Type/dynamic/accessor_holder.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Fri Mar 11 14:59:46 CET 2011
Author: vincent
Date: Fri Mar 11 14:59:45 2011
New Revision: 44185
URL: http://svn.erp5.org?rev=44185&view=rev
Log:
Don't use getattr to access subobjects on an acquisiton-wrapped object.
If some looked-up id is missing, it would be searched in acquisition, which is
not desired.
If some looked-up id exists as a method id on container's class, it will be
fetched instead of a subobject, which is not desired.
Example case, which happened to me: searching for "Title" returns an accessor
from CMF.
Modified:
erp5/trunk/products/ERP5Type/dynamic/accessor_holder.py
Modified: erp5/trunk/products/ERP5Type/dynamic/accessor_holder.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/dynamic/accessor_holder.py?rev=44185&r1=44184&r2=44185&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/dynamic/accessor_holder.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/dynamic/accessor_holder.py [utf8] Fri Mar 11 14:59:45 2011
@@ -300,8 +300,10 @@ def getPropertySheetValueList(site, prop
for property_sheet_name in property_sheet_name_set:
try:
- property_sheet = getattr(property_sheet_tool, property_sheet_name)
- except AttributeError:
+ property_sheet = property_sheet_tool._getOb(property_sheet_name)
+ except (AttributeError, KeyError):
+ # XXX: OFS.Folder explicitly raises AttributeError, BTreeFolder2
+ # implicitly raises KeyError...
LOG("ERP5Type.dynamic", WARNING,
"Ignoring missing Property Sheet " + property_sheet_name)
More information about the Erp5-report
mailing list