[Python-Dev] [RFC] urlparse - parse query facility (original) (raw)
O.R.Senthil Kumaran orsenthil at users.sourceforge.net
Sat Jun 16 10:41:01 CEST 2007
- Previous message: [Python-Dev] [RFC] urlparse - parse query facility
- Next message: [Python-Dev] Requesting commit access to python sandbox. Cleanup urllib2 - Summer of Code 2007 Project
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
- Fred L. Drake, Jr. <fdrake at acm.org> [2007-06-16 01:06:59]:
> * Coding question: Without retyping the bunch of code again in the > BaseResult, would is the possible to call parseqs/parseqsl function on > self.query and provide the result? Basically, what would be a good of > doing it.
That's what I was thinking. Just add something like this to BaseResult (untested): def parsedQuery(self, keepblankvalues=False, strictparsing=False): return parseqs( self.query, keepblankvalues=keepblankvalues, strictparsing=strictparsing) def parsedQueryList(self, keepblankvalues=False, strictparsing=False): return parseqsl( self.query, keepblankvalues=keepblankvalues, strictparsing=strictparsing)
Thanks Fred. That really helped. :-)
I have updated the urlparse.py module, cgi.py and also included in the tests in the test_urlparse.py to test this new functionality. test run passed for all the valid queries, except for these:
("=", {}),
("=&=", {}),
("=;=", {}),
The testcases are basically from test_cgi.py module and there is comment on validity of these 3 tests for query values.
Pending stuff is updating the documentation.
I maintained all the files temporarily at:
http://cvs.sarovar.org/cgi-bin/cvsweb.cgi/python/?cvsroot=uthcode
I had requested a commit access to Summer of Code branch in my previous mail, but I guess it not been noticed yet. I shall update the files later or send in as patches for application.
Whether there's a real win with this is unclear. I generally prefer having an object that represents the URL and lets me get what I want from it, rather than having to pass the bits around to separate parsing functions. The
I agree. This is really convenient when one comes to know about it.
Thanks, Senthil
-- O.R.Senthil Kumaran http://uthcode.sarovar.org
- Previous message: [Python-Dev] [RFC] urlparse - parse query facility
- Next message: [Python-Dev] Requesting commit access to python sandbox. Cleanup urllib2 - Summer of Code 2007 Project
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]