[Erp5-report] r12902 - in /erp5/trunk/products/ERP5Form: Form.py FormulatorPatch.py

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Feb 20 11:14:56 CET 2007


Author: romain
Date: Tue Feb 20 11:14:55 2007
New Revision: 12902

URL: http://svn.erp5.org?rev=12902&view=rev
Log:
DatetimeField has to manage th empty string as default value as the other field.
It is required for compatibility with ProxyField.

Modified:
    erp5/trunk/products/ERP5Form/Form.py
    erp5/trunk/products/ERP5Form/FormulatorPatch.py

Modified: erp5/trunk/products/ERP5Form/Form.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Form/Form.py?rev=12902&r1=12901&r2=12902&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Form/Form.py (original)
+++ erp5/trunk/products/ERP5Form/Form.py Tue Feb 20 11:14:55 2007
@@ -142,12 +142,11 @@
         #value=value() # Mising call ??? XXX Make sure compatible with listbox methods
 
     if id == 'default':
-        if self.meta_type != 'DateTimeField':
-          # We make sure we convert values to empty strings
-          # for most fields (so that we do not get a 'value'
-          # message on screeen)
-          # This can be overriden by useing TALES in the field
-          if value is None: value = ''
+        # We make sure we convert values to empty strings
+        # for most fields (so that we do not get a 'value'
+        # message on screen)
+        # This can be overriden by using TALES in the field
+        if value is None: value = ''
 
     return value
 

Modified: erp5/trunk/products/ERP5Form/FormulatorPatch.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Form/FormulatorPatch.py?rev=12902&r1=12901&r2=12902&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Form/FormulatorPatch.py (original)
+++ erp5/trunk/products/ERP5Form/FormulatorPatch.py Tue Feb 20 11:14:55 2007
@@ -806,7 +806,10 @@
             return date_result
     
     def format_value(self, field, value, mode='html'):
-        if value is None:
+        # Is it still usefull to test the None value,
+        # as DateTimeField should be considerer as the other field
+        # and get an empty string as default value?
+        if value in (None, ''):
             return ''
 
         use_ampm = field.get_value('ampm_time_style')
@@ -1121,6 +1124,7 @@
   value = self._get_default(widget_key, value, REQUEST)
   __traceback_info__ = ('key=%s value=%r' % (key, value))
   return self.widget.render_htmlgrid(self, widget_key, value, REQUEST)
+
 Field.render_htmlgrid = Field_render_htmlgrid
 
 def Widget_render_htmlgrid(self, field, key, value, REQUEST):




More information about the Erp5-report mailing list