[Zope] Help with simple dtml-if compare
Rik Hoekstra
rik.hoekstra@inghist.nl
Fri, 26 May 2000 10:53:12 +0200
<snip>
>
> yep.. well... this is quite a common question, all up. It comes from people
> using shorthand, but not relaising it. sometimes i wonder if this feature
> should be removed.
>
> the line:
>
> <dtml-if "id == 'index_html'">
>
> is actually shorthand for:
>
> <dtml-if expr="id == 'index_html'" >
>
> which means your expression is handled as a python expression, not a DTML
> one. In which case, you are comparing a function object (id) with a string
> object ('index_html').
>
> the simple fix is, of course, to 'call' the function....
>
> <dtml-if "id() == 'index_html'">
>
> should do what you're expecting.
Um, except that id is not always a method ;-(, hence the _['id'] idiom
(see discussion earlier this week)
Rik