[mod_python] why is this false: 'form' in dir(req)?

Graham Dumpleton grahamd at dscpl.com.au
Wed Dec 13 16:34:40 EST 2006


Daniel Nogradi wrote ..
> Each mod_python request object has an attribute form (at least the
> ones I came accross so far), yet the following is false:
> 
> 'form' in dir(req)
> 
> Any reason I'm not seeing why?

The request object is principally a C code based wrapper around the Apache
request_rec structure. At the same time though, it still allows adding of
attributes from within Python. None of those extra attributes however show
up when using dir(), only those corresponding to attributes in the request_rec
structure and a few others implemented at the C code level show up. It is a
known shortcoming and probably could be fixed but no one has ever probably
looked at it.

BTW, using hasattr(req, 'form') does still work.

Graham


More information about the Mod_python mailing list