Re: Various musings about the request URL / URI / whatever
Hmmm, go away for two days and a mail storm erupts. :-( I may never be able to catch up and digest this mail thread, but I'll try and add a few comments of my own. On 01/12/2005, at 8:41 AM, Nicolas Lehuen wrote: c) We don't have a req.base_uri (to follow Jim's naming suggestion) or req.script_name that would be equivalent to req.subprocess_env.get(SCRIPT_NAME), but we have a req.path_info... Why is this missing ? Note that SCRIPT_NAME as obtainable from Apache appears to be broken. See: http://issues.apache.org/jira/browse/MODPYTHON-68 Also note that with respect to req.uri and req.path_info, be aware that req.path_info is normalised and req.uri is not. Ie., the latter may have duplicated instances of '/' in it whereas that cannot occur in req.path_info. This makes it error prone to take the len() of req.path_info to work out how much to drop off req.uri to obtain the base uri or script name, you need to normalise req.uri first, but then the result will be missing the duplicates instances of '/' unless you use some more elaborate algorithm to work it out. Graham
[jira] Updated: (MODPYTHON-93) Improve util.FieldStorage efficiency
[ http://issues.apache.org/jira/browse/MODPYTHON-93?page=all ] Mike Looijmans updated MODPYTHON-93: Attachment: modpython325_util_py_dict.patch What it does: - Simplifies the creation of StringField objects. This was already marked as a TODO in the 3.2.5b code. - Does not create a file object (cStringIO) for each and every field. - FieldStorage.get() will always return the same instance(s) for any given name. - FieldStorage.get() is very cheap now (does not create new objects, which is expensive in Python) - use a dictionary-on-demand. - Lots of code removed for this one, and a few lines added. - items() function, which, contrary to common belief, preserves argument ordering. Improve util.FieldStorage efficiency Key: MODPYTHON-93 URL: http://issues.apache.org/jira/browse/MODPYTHON-93 Project: mod_python Type: Improvement Components: core Versions: 3.3 Reporter: Jim Gallacher Assignee: Jim Gallacher Priority: Minor Attachments: modpython325_util_py_dict.patch Form fields are saved as a list in a FieldStorage class instance. The class implements a __getitem__ method to provide dict-like behaviour. This method iterates over the complete list for every call to __getitem__. Applications that need to access all the fields when processing the form will show O(n^2) behaviour where n == the number of form fields. This overhead could be avoided by creating a dict (to use as an index) when the FieldStorage instance is created. Mike Looijmans has been investigating StringField and Field as well. It is probably reasonable to include information on his work in this issue as well, so that we can consider all of these efficiency issues in toto. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira