[Zope] ZSQL and REQUEST variables
Ben Glazer
glazer@scicomp.com
Wed, 16 Feb 2000 14:59:03 -0600
Ulli --
I think Zope (ZServer?) is doing (more or less) the equivalent of the
following when it parses your URL:
<dtml-call "REQUEST.set('entryid', '0')">
That is, it's setting entryid to the string "0", rather than the integer 0.
In Python, the string "0" evaluates to true; you seem to want it to evaluate
to false. Try this (UNTESTED CODE) in your ZSQL method:
SELECT * FROM DIRECTORYSUBMIT_ENTRIES
<dtml-sqlgroup where>
<dtml-if "entryid != '0'">
<dtml-sqltest entryid column=id type=int>
</dtml-if>
<dtml-and>
<dtml-if "categoryconfig != '0'">
<dtml-sqltest categoryconfig type=int>
</dtml-if>
</dtml-sqlgroup>
Regards,
Ben
> -----Original Message-----
> From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of
> Ulrich Wisser
> Sent: Wednesday, February 16, 2000 2:29 PM
> To: zope@zope.org
> Subject: [Zope] ZSQL and REQUEST variables
>
>
> Hello,
>
> I defined a ZSQL method with two optional arguments
>
> categoryconfig:int=0 entryid:int=0
>
> SELECT * FROM DIRECTORYSUBMIT_ENTRIES
> <dtml-sqlgroup where>
> <dtml-if entryid>
> <dtml-sqltest entryid column=id type=int>
> </dtml-if>
> <dtml-and>
> <dtml-if categoryconfig>
> <dtml-sqltest categoryconfig type=int>
> </dtml-if>
> </dtml-sqlgroup>
>
> When I call the test interface like
>
> http://server/sqlListDirEntries/manage_test?categoryconfig%3Aint=0
> &entryid%3Aint=0&SUBMIT=Submit+Query
>
> (note the "%3Aint") evrything works. The resulting SQL statement is
>
> SELECT * FROM DIRECTORYSUBMIT_ENTRIES
>
> When I call
>
> http://server/sqlListDirEntries/manage_test?categoryconfig=0&entry
> id=0&SUBMIT=Submit+Query
>
> (noew "%3Aint" is missing) I get
>
> SELECT * FROM DIRECTORYSUBMIT_ENTRIES
> where
> (id=0
> and categoryconfig=0
> )
>
> What would be the correct if clause?
>
> Thanks
>
> Ulli
>
> --
> ----------------- Die Website Effizienzer ------------------
> luna-park Bravo Sanchez, Vollmert, Wisser GbR
> Ulrich Wisser mailto:u.wisser@luna-park.de
> Alter Schlachthof, Immenburgstr. 20 Tel +49-228-9654055
> D-53121 Bonn Fax +49-228-9654057
> ------------------http://www.luna-park.de ------------------
>
>
>
> _______________________________________________
> Zope maillist - Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> ** No cross posts or HTML encoding! **
> (Related lists -
> http://lists.zope.org/mailman/listinfo/zope-announce
> http://lists.zope.org/mailman/listinfo/zope-dev )
>
>