[Zope] Re: Easy One
Dieter Maurer
dieter@handshake.de
Mon, 10 Mar 2003 00:19:50 +0100
Bergen Moore wrote at 2003-3-7 11:54 -0800:
> I just built a python script called url_quote (in my 'code' folder) and
> called it like so from dtml:
> <dtml-var "webClient('http://192.168.0.1/getSqlResults?query=' +
> code.url_quote(querystring))">
>
> The script: (with Parameter List having the parameter 'astring')
> # Import a standard function
> from Products.PythonScripts.standard import url_quote_plus
>
> # Return a string suitable for URL's.
> return "%s" % url_quote_plus(astring)
This is the same as "return url_quote_plus(astring)",
just a bit more complex ;-)
> Ok .. this should be really easy but it's driving me nuts. How to I set
> an attribute on a variable when it's being rendered inside of a
> function? Here's what I mean:
>
> <dtml-var "webClient('http://192.168.0.1/getSqlResults?query=' +
> querystring)">
<dtml-var "webclient(.... + url_quote(querystring))">
provided that your "url_quote" script is accessible from the
current DTML namespace.
Dieter