[Zope] how does dtml-if evaluate REQUEST variables?

Michel Pelletier michel@digicool.com
Sun, 20 Feb 2000 19:44:26 -0800


J C Lawrence wrote:
> 
> On Wed, 16 Feb 2000 21:32:25 +0100
> Ulrich Wisser <u.wisser@luna-park.de> wrote:
> 
> > <dtml-if entryid>
> > evalutes true when
> > http://server/dtml.doc?entryid=0
> > is called. I thought 0 would evaluate to false. How can I tell
> > dtml to evalute to false?
> 
> In case you haven't gotten a reply already (I don't see one on quick
> scan).
> 
> My observation is that when variables are passed in the URL they aee
> typed as strings, and thus you end up with (effectively):
> 
>   entryid="0"
> 
> which most certainly isn't false.
> 
> Try this:
> 
>   <dtml-if "_.int(entryid)">

Or, explicitly tell ZPublisher to marshal 'entryid' into an integer:

http://server/dtml.doc?entryid:int=0

This has the disadvantage of not allowing you to <dtml-try> to do it
yourself and handle the error your way...

-Michel