[Zope] How to check type of variable in DTML

hans hans@beehive.de
Wed, 08 May 2002 15:21:41 +0100


"Schmidt, Allen J." wrote:

> I am passing a variable to a ZSQL method and I need to check whether its a
> string or a list before it is part of a WHERE statement. How can I check
> this?
>

you dont need to. Zope can do this for you.
especially <dtml-sqlvar ...> and <dtml-sqltest>
see
http://www.zope.org/Members/jshell/ZSQLMethods-InsertingData

> <dtml-if mk>
>   CMAKE IN ( <dtml-var "mk[1:-1}"> )
> </dtml-if>
>
> This works well if its a list but blows up if just a string.
> Needs to be like this:
>
> <dtml-if mk is_A_list>
>   CMAKE IN ( <dtml-var "mk[1:-1}"> )
> <dtml-else>
>   <dtml-var sqltest mk column=CMAKE type=nb optional>
> </dtml-if>

--
-------------------------------------------------------------
Who's got only a hammer sees the world as a nail
hans augustin  (software developer)           hans@beehive.de
beehive elektronische medien GmbH       http://www.beehive.de
phone: +49 30 847-82 0                  fax: +49 30 847-82 299