[Zope] newbie: how to url_quote

Hung Jung Lu hungjunglu@hotmail.com
Mon, 10 Apr 2000 11:24:33 PDT


--- In zope@egroups.com, Chien-pin Wang <cpw@s...>  wrote:
>Question: how do I url_quote my <error code> and <error message> in
>dtml-call tag? I have tried both the tag form of <dtml-var and the short
>hand form &dtml.url_quote but both got invalid syntax. Please help and

I don't know short solutions. Zope might have some functions
implemented already.

But in the long run, you will need a whole set of conversion
functions to handle conversion of things between (1) the
database, (2) Javascript syntax (think about supplying a
string as an argument to a Javascript function inside
DTML, believe me, it's a nightmare.), (3) date/money
formats (e.g: $1,234,567.89, 2000/01/03 03.24.578, etc.
Yes yes, I have played plenty with DateTime() class and
I know its features and shortcomings.) Etc, etc.

So, you might as well start preparing your own external
methods to handle conversions. My experience is that each
person's needs differ from another person's needs. So
unless you've got your own skills in converting stuff,
you'll be suffering again and again.

In your case, use an external method

---------------------------------------
#
# myConversions.py
#

import urllib

def myUrlQuote(self, x):
    return urllib.quote_plus(x)
---------------------------------------

If you don't know what an external method is, learn it first.

Hung Jung

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com