[Zope] How to use double quotes (") in a string in a python expression in dtml

Oleg Broytmann Oleg Broytmann <phd@phd.pp.ru>
Thu, 21 Mar 2002 16:58:31 +0300


On Thu, Mar 21, 2002 at 02:45:46PM +0100, Igor Leturia wrote:
>   I want to check in dtml if a string variable contains double quotes
> ("), so I include a python expression in a dtml-if, something like this:
> 
>   <dtml-if "_.string.find(s,'"')<>-1">
> 
>   Of course, this doesn't work as the dtml interpreter thinks the " is
> the end of the python expression. But I tried it with \" also, and it
> doesn't work.
> 
>   Any ideas?

   DTML parser is too weak. :(
<dtml-if "_.string.find(s, _.chr(34)) <> -1">

Oleg.
-- 
     Oleg Broytmann            http://phd.pp.ru/            phd@phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.