am i using hasattr() and getattr() wrong?
Doug
doug at notAvalidEmail.com
Mon May 19 02:28:38 EDT 2003
hello,
the code that is related and doesnt seem to be working is:
---------
passed_data = cgi.FieldStorage()
if hassattr(passed_data, "user"):
user1 = passed_data.getvalue("user")
else:
user1 = "Null"
-------------
if i just do a straight assignment without any testing user1 gets assigned
user's value. I realized later that i could simplify all of this by just
using getattr(), but that also did not work. am i using these to functions
wrongly? and if so can someone point me to a function or object.method i
should be using to do this type of test?
Best regards,
Doug
More information about the Python-list
mailing list