[Zope] access to DTML's quoting and formatting
(was: [Zope] ID = "somebody@someserver.com"... ?)
(was: [Zope] ID = "somebody@someserver.com"... ?)
Dieter Maurer
dieter@handshake.de
Thu, 9 Nov 2000 21:59:20 +0100 (CET)
Thomas Søndergaard writes:
> ....
> I know that I must use url_quote, but how do I do that...?
Zope *SHOULD* export all quoting and formating functions to
be used in expressions. Unfortunately, it does not.
You can emulate it with specialized DTML methods. As an example:
"url_quote":
Define the DTML method: url_quote as:
<dtml-var text url_quote>
Ensure, there is no whitespace whatsoever before '<' or after '>'!
You call this function with: url_quote(text=<your_text>)
> <dtml-call "REQUEST.set('firstname', firstnam)">
> <dtml-call "REQUEST.set('surname', surnam)">
Get rid of these by using the correct name in the first place!
> <dtml-call "REQUEST.set('email', eadr)">
<dtml-call "REQUEST.set('email', url_quote(text=eadr))">
> ...
As someone else already pointed out, you can use
"_.string.replace(eadr,'@','_')" if only the '@' makes
problems. But email addresses may contain other funny
characters not allowed in id's. Therefore, "url_quote" is
safer (but not completely safe -> '/').
Dieter