Commit f87e1a76 authored by Vincent Pelletier's avatar Vincent Pelletier

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.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@45720 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 88a900eb
...@@ -1485,8 +1485,10 @@ class DateTimeWidget(Widget): ...@@ -1485,8 +1485,10 @@ class DateTimeWidget(Widget):
# Is it still usefull to test the None value, # Is it still usefull to test the None value,
# as DateTimeField should be considerer as the other field # as DateTimeField should be considerer as the other field
# and get an empty string as default value? # and get an empty string as default value?
if value in (None, ''): if not isinstance(value, DateTime):
return '' if value is None:
value = ''
return value
use_ampm = field.get_value('ampm_time_style') use_ampm = field.get_value('ampm_time_style')
use_timezone = field.get_value('timezone_style') use_timezone = field.get_value('timezone_style')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment