[mod_python] FieldStorage class is a "dictionary", but how do I tell?

Grant Beasley gbeasley at tsa.ac.za
Mon May 20 11:53:41 EST 2002


I have a function that tries to check whether its input is a dictionary (It
behaves differently depending on the input type). To do this, it firstly
checks for objects whose type is equal to type({}) and secondly for objects
which are instances of UserDict. The FieldStorage class matches neither of
these, despite the fact that it behaves like a dictionary (mappable object).
Am I using the wrong test, or this this a problem with the FieldStorage
class that it should conform to the above?

Of course, I could use a try block to attempt to access the object as a
dictionary, but this seems inefficient (I'd rather check explicitly).

Grant Beasley

More information about the Mod_python mailing list