[mod_python] strange behavior of form + patch for mod_python

Gregory (Grisha) Trubetskoy grisha at modpython.org
Sat Nov 26 15:25:37 EST 2005


On Sat, 26 Nov 2005, Jim Gallacher wrote:

> I could personally support changes to FieldStorage such that form fields are 
> coerced to a particular python type, similar to zope. Zope example:
>
> <input type="checkbox" name="testkey:list" value="1" />

IMO that's more functionality than necessary, you can always do such 
conversion in user code and there is no need for mod_python to dictate how 
it's done and introduce new syntax - this is something that'd be 
appropriate for a mod_python-based framework of some kind, but not in mp 
itself.

> I do find the current implementation of FieldStorage.__getitem__ a little odd 
> from a performance perspective. Each __getitem__ call loops through the 
> entire field list resulting in O(n^2) behaviour if you need to process all 
> the fields in a form. Ouch. I can't see why we can't creat a dict when the 
> form data is initally processed. I think this is worthwhile investigating for 
> version 3.3.

I'm pretty sure there was a reason why it had to be a list, I just can't 
remember what it was. It may be that order of fields is significant.

Grisha


More information about the Mod_python mailing list