[Zope] Problem using dtml-in in ZSQL method

Jeff Peterson jeff.peterson at crary.com
Thu Dec 11 10:34:07 EST 2008


Shouldn't this: <dtml-sqlvar sequence-item type=int> be <dtml-var sequence-item type=int> ?

--
Jeffrey D Peterson
Webmaster
Crary Industries, Inc.

From: zope-bounces at zope.org [mailto:zope-bounces at zope.org] On Behalf Of Françoise CONIL
Sent: Thursday, December 11, 2008 4:21 AM
To: zope at zope.org
Subject: [Zope] Problem using dtml-in in ZSQL method

Hello,

My ZSQL method receive a *mylist* parameter that should be an integer list : [21,35]

The following code does not work :

SELECT *
FROM MyTable
WHERE
  id in
    (<dtml-in mylist>
        <dtml-sqlvar sequence-item type=int> <dtml-if sequence-last><dtml-else>,</dtml-if>
    </dtml-in>)
*Type de l'erreur*
NameError
*Valeur de l'erreur*
'client' may not be used as an argument name in this context

This other code does not work better :

SELECT *
FROM MyTable
WHERE
  id in
    (<dtml-in mylist prefix="myid">
        <dtml-sqlvar expr="myid_item" type=int> <dtml-if sequence-last><dtml-else>,</dtml-if>
    </dtml-in>)

*Same error*

However, if I use a dictionary list of this type [{'id':21},{'id':35}]  with the following code, it works (but it's heavy)

SELECT *
FROM MyTable
WHERE
  id in
    (<dtml-in mylist mapping>
        <dtml-sqlvar id type=int> <dtml-if sequence-last><dtml-else>,</dtml-if>
    </dtml-in>)

The python script that calls my ZSQL method has already build the integer list and I would like to use it as is.

Thanks for your help
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20081211/5bafbd98/attachment.html 


More information about the Zope mailing list