am i using hasattr() and getattr() wrong?

Alex Martelli aleax at aleax.it
Mon May 19 02:44:32 EDT 2003


Doug wrote:

> the code that is related and doesnt seem to be working is:
> 
> ---------
> passed_data  = cgi.FieldStorage()
> 
> if hassattr(passed_data, "user"):

mis-spelling here but i don't think it's your real problem.

>     user1 = passed_data.getvalue("user")
> else:
>     user1 = "Null"

user1 = passed_data.getfirst('user', 'Null')

may be what you're looking for.


Alex





More information about the Python-list mailing list