[Zope] URL quoting in python
Kapil Thangavelu
kvthan@wm.edu
Fri, 21 Jul 2000 15:40:18 -0700
Thanks for the tip Duncan,
I find it strange that this utility function is not in the _ namepace...
time to make a trip to the Tracker. It seems like a url-encoding
function should be directly accessible from zope.
Thanks
Kapil
Duncan Booth wrote:
>
> > I often create an external method for this...
> >
> > em:
> >
> > def url_quote(s):
> > import urllib
> > return urllib.quote_plus(s, safe='')
> >
> > Silly, but it works.
> >
> > I think the alternative is to hack the DT_Util.py module in the
> > DocumentTemplate directory to expose urllib or a derived function.
>
> Isn't an external method a bit overkill? It is possible to just create a
> DTML Method called url_quote where the body is:
> <dtml-var s url_quote>
>
> (making sure there is no whitespace before this line, and no
> newline after it.)
>
> Then from any other DTML method you just call it remembering to
> pass in the parameter by name.
>
> e.g.
> <dtml-call
> "RESPONSE.redirect(URL1+'?foo_bar='+url_quote(s=ufoobar))">
>
> --
> Duncan Booth duncan@dales.rmplc.co.uk
> int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
> "\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?
> http://dales.rmplc.co.uk/Duncan
>
> _______________________________________________
> 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 )