[Erp5-report] r45720 vincent - /erp5/trunk/products/Formulator/Widget.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Apr 28 11:28:24 CEST 2011


Author: vincent
Date: Thu Apr 28 11:28:24 2011
New Revision: 45720

URL: http://svn.erp5.org?rev=45720&view=rev
Log:
Pass value through if it's not a DateTime.

This solves a crash when a ListBox with a DateTimeField as editable field is
used to filter with a non-date expression (ex: ">01/04/2011").
Still, keep existing exception about None being converted to empty string.

Modified:
    erp5/trunk/products/Formulator/Widget.py

Modified: erp5/trunk/products/Formulator/Widget.py
URL: http://svn.erp5.org/erp5/trunk/products/Formulator/Widget.py?rev=45720&r1=45719&r2=45720&view=diff
==============================================================================
--- erp5/trunk/products/Formulator/Widget.py [utf8] (original)
+++ erp5/trunk/products/Formulator/Widget.py [utf8] Thu Apr 28 11:28:24 2011
@@ -1485,8 +1485,10 @@ class DateTimeWidget(Widget):
     # 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 ''
+    if not isinstance(value, DateTime):
+      if value is None:
+        value = ''
+      return value
 
     use_ampm = field.get_value('ampm_time_style')
     use_timezone = field.get_value('timezone_style')



More information about the Erp5-report mailing list