[Erp5-report] r15890 - /erp5/trunk/products/ERP5Type/Utils.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Wed Aug 29 11:02:07 CEST 2007
Author: jerome
Date: Wed Aug 29 11:02:06 2007
New Revision: 15890
URL: http://svn.erp5.org?rev=15890&view=rev
Log:
fix assertAttributePortalType, it was using acqusition to get the object.
This is only a problem if for instance you have a person with id "default_address".
Modified:
erp5/trunk/products/ERP5Type/Utils.py
Modified: erp5/trunk/products/ERP5Type/Utils.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Utils.py?rev=15890&r1=15889&r2=15890&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Utils.py (original)
+++ erp5/trunk/products/ERP5Type/Utils.py Wed Aug 29 11:02:06 2007
@@ -2696,22 +2696,24 @@
portal_type -- string or list
"""
# Checks or deletes
- if hasattr(o,attribute_name):
+ if getattr(o, attribute_name, None) is not None:
value = getattr(o, attribute_name)
if not isinstance(value, BaseClass):
# Delete local attribute if it exists
- if hasattr(aq_self(o),attribute_name):
+ if getattr(aq_self(o), attribute_name, None) is not None:
delattr(o, attribute_name)
# But do not delete object
#if attribute_name in o.objectIds():
# o._delObject(attribute_name)
- if hasattr(o,attribute_name):
+ if o._getOb(attribute_name, None) is not None:
try:
- if isinstance(portal_type, str): portal_type = [portal_type]
+ if isinstance(portal_type, str):
+ portal_type = [portal_type]
if getattr(o, attribute_name).portal_type not in portal_type:
o._delObject(attribute_name)
- except (KeyError, AttributeError):
- LOG("ERPType Warning: assertAttributePortalType",100,str(o.absolute_url()))
+ except (KeyError, AttributeError), err:
+ LOG('ERP5Type', PROBLEM, "assertAttributePortalType failed on %s" % o,
+ error=err)
#####################################################
# Monkey Patch
More information about the Erp5-report
mailing list