Apache Mod-Python - Re: Commented: (MODPYTHON-93) Improve util.FieldStorage

This is Interesting: Free IT Magazines  
Home > Archive > Apache Mod-Python > November 2005 > Re: Commented: (MODPYTHON-93) Improve util.FieldStorage





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Re: Commented: (MODPYTHON-93) Improve util.FieldStorage
Gregory (Grisha) Trubetskoy

2005-11-27, 2:46 am



Having looked at the FieldStorage code, I'm guessing the idea was that you
parse fields as they come in and append them to a list. This preserves
the original order of fields, in case it is needed.

I'm not sure that maintaining a dictionary alongside the list is the right
thing to do. It might be, but there are some difficult questions to answer
-e.g. how costly is a sequential search, and is the code complexity (and
fieldstorage code is no picnic to read as it is) worth the speedup?

Also while it would speed up retrieval, it will slow down the "write"
operation - when a field is added to fieldstorage you now need to append
it to the list, AND check whether it exists in the dictionary, then add it
there as well.

How often do developers access form fields via __getitem__? I noticed the
publisher does not use it - it iterates the list, so nothing would be
gained there.

Also, something else to consider - is there a simple programatic solution
that could be documented, e.g. something like

my_fs = util.FieldStorage(req)

dict_fs = {}
dict_fs.update(my_fs)

[have no idea whether this will work :-)]

and voila - you've got a dictionary based fieldstorage?

Anyway, just a few cents from me.

Grisha

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com