Re: [Zope] Stripping Quotes
doesn't work. the double quotes are not escaped and zope sees them as the end of the expression.
From: "Jaroslav Lukesh" <lukesh@seznam.cz> Date: August 29, 2007 6:16:12 PM EDT To: "Zope user list" <zope@zope.org>, "Tom Von Lahndorff" <tom@modscape.com> Subject: Re: [Zope] Stripping Quotes
<dtml-var "_.str('string\"with\'quotes').replace('\"','').replace ('\'','')">
----- Original Message ----- From: "Tom Von Lahndorff" <tom@modscape.com>
Whats the best way to strip (double and/or single) quotes from a string in python and/or dtml? Thanks.
Sorry, it was my fault, here are better version: <dtml-var "_.str('string' + \" + 'with' + \' + 'quotes').replace(\",'').replace(\','')"> ----- Original Message ----- From: Tom Von Lahndorff To: Zope user list Sent: Tuesday, September 04, 2007 5:28 PM Subject: Re: [Zope] Stripping Quotes doesn't work. the double quotes are not escaped and zope sees them as the end of the expression.
From: "Jaroslav Lukesh" <lukesh@seznam.cz> Date: August 29, 2007 6:16:12 PM EDT To: "Zope user list" <zope@zope.org>, "Tom Von Lahndorff" <tom@modscape.com> Subject: Re: [Zope] Stripping Quotes
<dtml-var "_.str('string\"with\'quotes').replace('\"','').replace ('\'','')">
----- Original Message ----- From: "Tom Von Lahndorff" <tom@modscape.com>
Whats the best way to strip (double and/or single) quotes from a string in python and/or dtml? Thanks.
Tom Von Lahndorff wrote at 2007-9-4 11:28 -0400:
doesn't work. the double quotes are not escaped and zope sees them as the end of the expression.
From: "Jaroslav Lukesh" <lukesh@seznam.cz> Date: August 29, 2007 6:16:12 PM EDT To: "Zope user list" <zope@zope.org>, "Tom Von Lahndorff" <tom@modscape.com> Subject: Re: [Zope] Stripping Quotes
<dtml-var "_.str('string\"with\'quotes').replace('\"','').replace ('\'','')">
It is extremely long ago that I used DMTL intensively. Therefore, I may have forgotten a lot... But, when I remember right, then '"' had to be escaped by '\x22'. I.e. try: <dtml-var "'string\x22\'quotes'.replace('\22','')...."> Or, to get it a bit more readable: <dtml-let quote="'\x22'"> <dtml-var "('string' + quote + ...).replace(quote,'')..."> </dtml-let> Even better: use a Python Script (to work around DTML's syntactic pitfalls). -- Dieter
participants (3)
-
Dieter Maurer -
Jaroslav Lukesh -
Tom Von Lahndorff