[Zope] How can I call a ZSQL method in <dtml-if> tag?

Jin Chen jchen@nautilus.org
Wed, 20 Feb 2002 14:57:19 -0800


Hi there,

I am a newer to zope application. I met a problem of calling a ZQSL method
in the DTML if tag. Here is the example:

I have a ZSQL method called "CountCrew" which has no input parameter. the
query is: select count(*) from crew

1. I test it looks good on the ZSQL method "CountCrew" page. If the table
crew has no data, it returns 0, if has one record, it retuens 1...

2. I call this ZSQL method in a DTML method, code likes:

<dtml-if expr="CountCrew == 1">
<dtml-call "AddCrew(ptime=time1,name=name2,pemail=email1)">
<dtml-else>
<dtml-var Error>
</dtml-if>

But the <dtml-if ..> test is false and show the Error message no
mater there is one crew or none in the crew table.

If I test it like this:
<dtml-if "CountCrew">//or <dtml-if expr="CountCrew">
<dtml-call "AddCrew(ptime=time1,name=name2,pemail=email1)">
<dtml-else>
<dtml-var Error>
</dtml-if>
the <dtml-if ..> test is always true and add the record no mater there is
none  or one crew in the crew table.


You know, I want to add the record in the crew table only if there is at
least one crew exist in the crew table.

I don't know what's wrong with calling the ZSQL method in DTML if tag.
Please give me any advice if you have time.

Thanks in advance!

Jean

_______________________________________
Jean Chen

The Nautilus Institute
125 University Avenue
Berkeley, CA 94710-1616 USA
(510) 295-6113 * Fax: (510) 295-6130
jchen@nautilus.org
http://www.nautilus.org