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

Steven Lott s_lott at yahoo.com
Mon May 20 04:23:22 EST 2002


Yes, the FieldStorage class is a unique class, not derived from
UserDict.  It has dictionary-like methods.  

You want to check your argument, arg, with something like this

if isclass(arg,FieldStorage)

--- Grant Beasley <gbeasley at tsa.ac.za> wrote:
> Hi
> 
> 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).
> 
> Thanks
> Grant Beasley
> 
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://www.modpython.org/mailman/listinfo/mod_python


=====
--
S. Lott, CCP :-{)
S_LOTT at YAHOO.COM
http://www.mindspring.com/~slott1
Buccaneer #468: KaDiMa

Macintosh user: drinking upstream from the herd.

__________________________________________________
Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience
http://launch.yahoo.com



More information about the Mod_python mailing list