[Zope] quoting dtml in manage_edit

Dieter Maurer dieter@handshake.de
Fri, 12 Jul 2002 21:13:10 +0200

Bryan C. Andregg writes:
 > I'm using the input from a form to generate an email for a manager to either
 > approve or reject a specific action. I thought the easy way to do this would
 > be to create a random named DTML document, fill it with logic, and then put an
 > ACCEPT and a REJECT link to it in the email.
I am a bit puzzled by your approach:

  I would use a fixed action and provide the relevant information in
  the query string.

 > This works fine as long as I don't need to use quotes in the data string for
 > manage_edit: manage_edit('<dtml-var standard_html_header>',title)
You can use Python's escape syntax for strings.
There are three types: octal, hexadecimal and unicode escapes.
You are not interested in the last one.

Octal escapes have the form "\" followed by up to 3 octal digits.
The digits specify the character code.

Hexadecimal escapse have the form "\x" followed by 2 hexadecimal
digits. The digits specify the character code.

You can find out the character code of a character "c" by
"ord(c)". To get the octal encoding, you use "'%o' % ord(c)"
or "'%x' % ord(c)" for hexadecimal encoding.