[Zope-dev] Converters.field2date, allow empty string to return None?

Dieter Maurer dieter@handshake.de
Sun, 3 Sep 2000 13:33:12 +0200 (CEST)


Brad Clements writes:
 > One thing that has been bothering me is that I can't easily test my 
 > ZSQL Methods if they accept a date type unless I completely fill all the 
 > date arg types.
 > 
 > For example, if the sqlmethod has argument type 
 >   startdate:date=''
 > 
 > 
 > and in the body I have
 >  <dtml-if startdate> ...
 > 
 > When i use the test form, I can't leave the date field empty, otherwise I 
 > get a conversion error from Converters.field2date()

One solution would be to use a valid (special) date as default
value and test against it in the body.

 > I see that converters required: exists, but does that imply that all other 
 > converters allow an empty string to return None? Or do we need to add 
 > an explicit "optional" type?
I think, we should have an explicit "optional" because that
is the most clear way to say, this argument is optional.



Dieter