[Zope-dev] Collector issue #30: Empty dates

Brian Lloyd brian@zope.com
Tue, 19 Mar 2002 10:22:50 -0500


> > I agree. I'd specify this by saying:
> >
> >   o An empty string sent from a browser for an optional_date
> >     field is interpreted as a null (not specified) value
> >
> >   o The "internal" representation of an optional_date (the
> >     value you find in the REQUEST after conversion) is
> >     always either a valid DateTime instance or None
> 
> I think then the value in the fields will be shown as "None", 
> which I don't
> particularily like, even though I would rather have None as the internal
> representation instead of an empty string. Is there a way to fix that, so
> that date_fields set to None will be displayed as empty?

Sure. The property forms just need to do the equivalent 
of: 

<dtml-if theDate>
<dtml-var theDate fmt="somthing">
</dtml-if>

I know that this is a style issue to some, but I feel that 
the value should either be null or valid, and code and 
templates should be written to deal with the two possibilities 
as a matter of course.


Brian Lloyd        brian@zope.com
V.P. Engineering   540.361.1716       
Zope Corporation   http://www.zope.com