I have a little dtml and python and I'd like to call the python with a string containing a double quote: <dtml-var expr="pything('she said "Yes."')"> Obviously, this doesn't work. Not so obviously, these don't work either. <dtml-var expr="pything('''She said "Yes."''')"> <dtml-var expr="pything('She said \"Yes.\"')"> The only solution I've found is the icky: <dtml-var expr="pything('She said \x22Yes.\x22')"> or <dtml-var expr="pything('She said \042Yes.\042')"> Is that the only way? Does dtml lack any kind of escape sequence? I can understand why there wouldn't be one but I'd like to be sure before I go
Is that the only way? Does dtml lack any kind of escape sequence? I can understand why there wouldn't be one but I'd like to be sure before I go
Pretty much. I guess its mostly the DTML parser's fault, it has no way of distinguishing between the " inside your text and the " at the end of the python statement. Annoying huh? -- Andy McKay Agmweb Consulting http://www.agmweb.ca
Charlie Reiman writes:
... The only solution I've found is the icky:
<dtml-var expr="pything('She said \x22Yes.\x22')">
or
<dtml-var expr="pything('She said \042Yes.\042')">
Is that the only way? Does dtml lack any kind of escape sequence? I can understand why there wouldn't be one but I'd like to be sure before I go You can also use the "chr" function (--> Python library reference), but I do not think, it is easier.
Dieter
participants (3)
-
Andy McKay -
Charlie Reiman -
Dieter Maurer