From f87e1a7632c0117e3aa0d10be8502159554b02f6 Mon Sep 17 00:00:00 2001 From: Vincent Pelletier <vincent@nexedi.com> Date: Thu, 28 Apr 2011 09:28:24 +0000 Subject: [PATCH] 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 --- product/Formulator/Widget.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/product/Formulator/Widget.py b/product/Formulator/Widget.py index e9757b4d39..2fcc9016c5 100644 --- a/product/Formulator/Widget.py +++ b/product/Formulator/Widget.py @@ -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') -- 2.30.9