The normal way to deal with this is percent-encoding. http://en.wikipedia.org/wiki/Percent-encoding
So "/product/some&product" becomes "/product/some%26product" before the client makes the request. Hopefully the client is already doing that, or you have the ability to make it do that. See urllib.quote() and urllib.unquote() http://docs.python.org/2/library/urllib.html#utility-functions Michael On Thursday, January 31, 2013 9:44:53 PM UTC-5, Andrew Kowalik wrote: > > Reading an url as follows: > > example.com/product/xyz > > urls = ('/product/(.*)', product) > > in the product class on GET I am reading the that product ID pulled from > the URL to create a DB query. Some of those IDs have an & in them, when I > receive that value in python it has been escaped, but I have had 0 luck > unescaping it back so I can run the query correctly. The following do not > work: > > product = product.replace("&", "&") > product = HTMLParser.unescape.__func__(HTMLParser,product) > > Whats the best practice in Web.py or even Python? Thanks > -- You received this message because you are subscribed to the Google Groups "web.py" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/webpy?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
