Re: [Zope-dev] Converters.field2date, allow empty string to return None?
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
On 3 Sep 2000, at 13:33, Dieter Maurer wrote:
One solution would be to use a valid (special) date as default value and test against it in the body.
I don't like this "solution" because the end-user has to know what the special date is, it looks ugly on the form and it still does *not* fix the problem of using the test function in an SQL Method. Brad Clements, bkc@murkworks.com (315)268-1000 http://www.murkworks.com (315)268-9812 Fax netmeeting: ils://ils.murkworks.com AOL-IM: BKClements
participants (2)
-
Brad Clements -
Dieter Maurer