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

Daniel Nogradi nogradi at gmail.com
Wed Dec 13 16:42:10 EST 2006

> > 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.

I see, thanks. The way it turned up for me was that I wanted to
inspect every attribute of the request object just to see what is
there and I did this with a loop over dir(req). So what would be the
good way to loop over every attribute (including the ones that dir
doesn't show)?

More information about the Mod_python mailing list