[Zope-dev] Z SQL: "optional" isn't?
Stuart 'Zen' Bishop
zen@cs.rmit.edu.au
Tue, 30 May 2000 17:09:20 +1000 (EST)
On Mon, 29 May 2000, Kyler B. Laird wrote:
> This is not the same functionality as is provided
> by the "optional" attribute. How would I use it
> with an integer, for example? I don't want a
> default value; I want the option of not having
> the value set at all.
>
> I like the optional attribute. I'd like to see
> it do more than sit idle in the code.
You don't have to do the typechecking in the 'arguments' box if you don't
want. eg. in your arguments section:
course=""
subject=""
And your method:
select * from enrolments
<dtml-sqlgroup where>
<dtml-sqltest course type=int optional>
<dtml-sqltest subject type=nb optional>
</dtml-sqlgroup>
The definition of the 'optional' tag from the docs might help here:
'''A flag indicating if the test is optional. If the test is optional
and no value is provided for a variable, or the value provided is
an invalid empty string, then no text is inserted'''
Hmm... looking at this definition, it seems you have found a bug
(but setting the default value to "" in the arguments section will
provide a workaround). Or maybe 'no value provided' means 'is None'.
Anyone from DC want to provide a ruling? :-)
--
Stuart Bishop Work: zen@cs.rmit.edu.au
Senior Systems Alchemist Play: zen@shangri-la.dropbear.id.au
Computer Science, RMIT University