RE: [Zope] A nice problem with url_quote_plus
Actually, I don't think url_quote_plus is what you want. I think rather you need to come up with a DTML method that replaces spaces with plus signs only. You don't want to URL-quote the whole url, because when doing so, you replace colons with %3a's, etc. You don't need to do this to pass this to a redirect, and as a matter of fact it won't work at all. Here's a DTRL method 'my_space_replacer' that does that: <dtml-var "_.string.replace(unquoted_url, ' ', '+')" > And here's a method that calls it: <dtml-call "REQUEST.set('unquoted_url', 'http://www.zope.org/Howdy there')"> <dtml-call "REQUEST.set('quoted_url', my_space_replacer(_.None, REQUEST))"> <dtml-call "RESPONSE.redirect(quoted_url)">
-----Original Message----- From: Nbk [mailto:nbk@cyberdude.com] Sent: Friday, April 28, 2000 6:42 AM To: zope@zope.org Subject: [Zope] A nice problem with url_quote_plus
Hi.
I have the folowing code in one of my DTML method's:
<dtml-call "RESPONSE.redirect(_.string.join([url,query],''))">
'url' and 'query' are two variables passed by the REQUEST. This work's just fine, but with some minor :-) problems in my case. If i have a 'query' with some spaces, the RESPONSE.redirect causes an obvious http error. So, i want to replace some characters of my 'query' variable. And guess what? <dtml-var url url_quote_plus> gives me the right string. How do i do an "quote_plus" ( like in python urllib module ) in Zope, without using an External Method?
BTW, i've used an python method, but with no luck ( i can't make a simple "import urllib").
TIA,
@886, Nbk ( Just believe, Zope source code is the best place to find up-to-date documentation! )
P.S. - I've looked up for the solution in www.google.com, www.egroups.com, lists.zope.org, www.zope.org, www.python.org, and some other resources. I had find some interesting ideas, but none of them are usefull to this problem. :-)
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
participants (1)
-
Chris McDonough