[mod_python] Accessing all form fields, empty strings or not

Diener, Edward Edward.Diener at loyaltyworks.com
Fri May 21 14:17:24 EDT 2004



> -----Original Message-----
> From: Gregory (Grisha) Trubetskoy [mailto:grisha at modpython.org] 
> Sent: Friday, May 21, 2004 11:36 AM
> To: Diener, Edward
> Cc: mod_python at modpython.org
> Subject: Re: [mod_python] Accessing all form fields, empty 
> strings or not
> 
> 
> 
> 
> On Fri, 21 May 2004, Diener, Edward wrote:
> 
> > I need to access all form fields in my mod_python PSP code, whether 
> > they are empty strings or not. The 'form' global variable 
> is created 
> > so that fields which have empty strings do not appear in the 'form'.
> 
> Are you sure that this is the case?
> 
> Looking at psp.py:
> 
>         # does this code use form?
>         form = None
>         if "form" in code.co_names:
>             form = util.FieldStorage(req, keep_blank_values=1)
> 
> 
> "keep_blank_values" is set to 1.

That is very strange because when I check the keys for my form (
form.keys() ), the checkbox field only exists in the list of keys when
the checkbox is checked but doesn't exist otherwise. But I do see the
code mentioned above in psp.py. Is there any other way to find out if a
field exists in a form irregardless whether its value is blank or not ?



More information about the Mod_python mailing list