We currently want to use date-properties in the regular property sheet.
The current date-property doesn't accept an empty value.
We want to be able to submit an empty string and set a NullDate value
indicating. Also a NullDate value should return an empty string when the
"manage_propertiesForm" is rendered, e.g. showing an empty field.

We have currently chosen a empty string "", to represent the NullDate value.
(We haven't found any NullDate representation in DateTime and have concluded
that it doesn't exist?)
Choosing None as the NullDate value would have been preferred but it
issues with the rendering of  "manage_propertiesForm".


Is there anything better then an empty string for the NullDate value?

Best Regards,
Johan Carlsson

[Here's our hot-patch]

from ZPublisher import Converters

def fixedfield2date(v):
    print "Fixed field2date conversion", fixedfield2date, v
    from DateTime import DateTime
    if hasattr(v,'read'): v=v.read()
    else: v=str(v)
    if v=='':
       return v
    return DateTime(v)

Converters.field2date = fixedfield2date
Converters.type_converters['date'] = fixedfield2date

print "ZPublisher.Converters.field2date patched."

Zope-Dev maillist  -  [EMAIL PROTECTED]
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope )

Reply via email to