About Example Code From Google
Why is this done uri = urlparse(self.request.uri) if uri.query: query = parse_qs(uri.query) try: query = query['query'][0] except KeyError, err: query =
Solution 1:
There's a few differences. The biggest is if the key query
appears multiple times in the uri, the first version will return the first instance while the second version will return the last instance.
Also, in the second version, if the key doesn't exist you'll get None
instead of ''
Potentially the author of v1 just didn't trust webob to parse his query string properly.
Post a Comment for "About Example Code From Google"