How to use double quotes (") in a string in a python expression in dtml
Hi all! 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? Igor Leturia
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.
Oleg Broytmann wrote:
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">
Haven't tried this in DTML, but in a ZPT I found you could use the hex escape for the char, so maybe this would work: <dtml-if "_.string.find(s,'\x22')<>-1"> Barry
participants (3)
-
Barry Pederson -
Igor Leturia -
Oleg Broytmann