Moving to Python from PHP - 3 questions

grahamd at dscpl.com.au grahamd at dscpl.com.au
Mon Feb 21 05:40:16 EST 2005


Michal Migurski wrote:
> 3) Structured request variables. PHP has a really handy feature where

> request variables with name like "foo[]", "foo[bar]", or
> "foo[bar][baz]" are automatically structured into nested associative
> arrays. I can see that the python cgi module will make a list of
> MiniFieldStorage objects when more than one variable with the same
name

Someone already piped in by suggesting Vampire for mod_python, so
would add that Vampire supports structured form variables by making
use of:

  http://svn.colorstudy.com/trunk/Validator/validator/variabledecode.py

Thus, if you follow the form naming conventions this code supports,
then data can be turned into lists and dictionaries as appropriate. The
only thing is the naming convention is different to what you list
above.
Read the comments in linked code to see what it does actually use.




More information about the Python-list mailing list