[Zope-DB] optional argument, can it be an empty string

Charlie Clark charlie at egenix.com
Mon Nov 8 10:54:20 EST 2004


On 2004-11-08 at 14:44:43 [+0100], Remy Pinsonnault 
<remy_pinsonnault at roche.ca> wrote:
> What about
> 
>      <dtml-if Mobile>
>          Mobile = <dtml-sqlvar Mobile type=string>,
>      <dtml-else>
>          Mobile = NULL,
>      </dtml-if>

This is definitely not what Kevin wants and probably highly undesirable. 
The condition has to be able to distinguish between "" and other false 
values, ie. whether a string is present at all which your solution won't: 
if Mobile is "", then the dtml-if evaluates as false. Writing this in 
<dtml> could get messy so using a PythonScript to check for "stringness" 
and pass an additional variable to the ZSQL method, ie "Mobile_is_there". 
This keeps the ZSQL cleaner.

Charlie
-- 
Charlie Clark
eGenix.com

Professional Python Services directly from the Source
 >>> Python/Zope Consulting and Support ...        http://www.egenix.com/
 >>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
 >>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________

::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::


More information about the Zope-DB mailing list