[Erp5-report] r38432 yo - /erp5/trunk/products/ERP5Form/ProxyField.py

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Sep 17 08:26:31 CEST 2010


Author: yo
Date: Fri Sep 17 08:26:30 2010
New Revision: 38432

URL: http://svn.erp5.org?rev=38432&view=rev
Log:
Add a hack to work around a bug that CheckBoxField may not even try to get a property value, because it has a default value 0 in the field definition itself. The same hack was performed against Form.py but this has been disabled mistakenly for a while, because monkey-patched methods were overridden in ProxyField.

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

Modified: erp5/trunk/products/ERP5Form/ProxyField.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Form/ProxyField.py?rev=38432&r1=38431&r2=38432&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Form/ProxyField.py [utf8] (original)
+++ erp5/trunk/products/ERP5Form/ProxyField.py [utf8] Fri Sep 17 08:26:30 2010
@@ -52,7 +52,8 @@ from Acquisition import aq_base, aq_inne
 from Products.ERP5Type.Globals import DTMLFile
 
 from Products.Formulator.TALESField import TALESMethod
-from Products.ERP5Form.Form import StaticValue, TALESValue, OverrideValue, DefaultValue, EditableValue
+from Products.ERP5Form.Form import StaticValue, TALESValue, OverrideValue, \
+        DefaultValue, EditableValue, DefaultCheckBoxValue
 from Products.ERP5Form.Form import copyMethod, isCacheable
 
 from Products.CMFCore.Skinnable import SKINDATA
@@ -682,6 +683,9 @@ class ProxyField(ZMIField):
     cacheable = isCacheable(value)
 
     if id == 'default' and field_id.startswith('my_'):
+      # XXX far from object-oriented programming
+      if template_field.meta_type == 'CheckBoxField':
+        return DefaultCheckBoxValue(field_id, value), cacheable
       return DefaultValue(field_id, value), cacheable
 
     # For the 'editable' value, we try to get a default value




More information about the Erp5-report mailing list