RE: [Zope] Expressions with strings with double-quotations?
-----Original Message----- From: Dave Parker [mailto:dparker@globalcrossing.com] Sent: Tuesday, December 21, 1999 8:51 AM To: zope@zope.org Subject: [Zope] Expressions with strings with double-quotations?
Well, this may sound silly, but...
I've been having a heck of a time figuring out how to do DTML expression which builds a string which contains a double-quotation mark in Zope 2.0. I've tried \", which is supposed to be the Python syntax for doing it, but to no avail. Any ideas?
This is (theoretically) as in <dtml-var "'hello \" world'"> - whenever I try anything like this Zope misses the escape and terminates the expression (colorfully)...
This can't be done; You can't get there from here. -Michel
Michel Pelletier wrote:
This is (theoretically) as in <dtml-var "'hello \" world'"> - whenever I try anything like this Zope misses the escape and terminates the expression (colorfully)...
This can't be done; You can't get there from here.
That's unfortunate given the bevy of logic I have that relies on proper CSV delimiting. I suppose I can use '+_.chr(#)+'. But that's pretty ugly. I suspect I have an understanding of the ugliness of the problem, but it really does detract from "expressions are a pure python environment"...
Tuesday, December 21, 1999, 3:34:29 PM, Michel Pelletier wrote:
This is (theoretically) as in <dtml-var "'hello \" world'"> - whenever I try anything like this Zope misses the escape and terminates the expression (colorfully)...
MP> This can't be done; You can't get there from here. Ahem. You can, just use the \xhh.. where hh.. is the hex code of the character, or use \ooo where ooo is the octal code of the character in question. See the Python Language Reference: http://www.python.org/doc/current/ref/strings.html In this case, use \x22 or \042: <dtml-var "'hello \x22 world'"> -- Best regards, Martijn Pieters mailto:mj@digicool.com
Martijn Pieters wrote:
Tuesday, December 21, 1999, 3:34:29 PM, Michel Pelletier wrote:
This is (theoretically) as in <dtml-var "'hello \" world'"> - whenever I try anything like this Zope misses the escape and terminates the expression (colorfully)...
MP> This can't be done; You can't get there from here.
Ahem. You can, just use the \xhh.. where hh.. is the hex code of the character, or use \ooo where ooo is the octal code of the character in question. See the Python Language Reference:
http://www.python.org/doc/current/ref/strings.html
In this case, use \x22 or \042:
<dtml-var "'hello \x22 world'">
Thanks! I am saved :)
Michel Pelletier wrote:
-----Original Message----- From: Dave Parker [mailto:dparker@globalcrossing.com] Sent: Tuesday, December 21, 1999 8:51 AM To: zope@zope.org Subject: [Zope] Expressions with strings with double-quotations?
Well, this may sound silly, but...
I've been having a heck of a time figuring out how to do DTML expression which builds a string which contains a double-quotation mark in Zope 2.0. I've tried \", which is supposed to be the Python syntax for doing it, but to no avail. Any ideas?
This is (theoretically) as in <dtml-var "'hello \" world'"> - whenever I try anything like this Zope misses the escape and terminates the expression (colorfully)...
This can't be done; You can't get there from here.
-Michel
t seesm like you should be able to do something with the ascii code for a double quote character. --sam
participants (4)
-
Dave Parker -
Martijn Pieters -
Michel Pelletier -
Sam Gendler