Commit c4a12d78 authored by Romain Courteaud's avatar Romain Courteaud

DatetimeField has to manage th empty string as default value as the other field.

It is required for compatibility with ProxyField.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@12902 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 773394a1
......@@ -142,12 +142,11 @@ def get_value(self, id, **kw):
#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
......
......@@ -806,7 +806,10 @@ class PatchedDateTimeWidget(DateTimeWidget):
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 @@ def Field_render_htmlgrid(self, value=None, REQUEST=None, key=None):
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):
......
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