[mod_python] the req object

David Bear David.Bear at asu.edu
Thu Jun 14 12:37:24 EDT 2007

On Wed, Jun 13, 2007 at 04:15:38PM -0400, Jim Gallacher wrote:
> Hi David,
> David Bear wrote:
> >When is the req object made available?
> >
> >
> >when the import dummymodule fails, the req object is not available to
> >it. Without the req object, how does one send output anywhere?
> That's a strange bit of code you have there. ;) Your code would only get 
> executed by mod_python once, when the module is first loaded.

strange becuase its only illustrates how I think I want to catch
exceptions on module imports.

Thank you so much for the great explanation below. I'll read it a
third time to see if I can make more sense of it.

Prior to that, what recommendations are there for catching exceptions
on module import failures. There is a vast amount of functionality
that isn't available untill modules are correctly imported. So I see a
heirarchy of needs -- modules that MUST import or the script MUST die.
Then, modules that should import or display and error to the browser.
Then, modules that could important -- for better, faster, stronger
ways of doing something, or my code could resort to doing something

So how would I handle the except when
1) critical module import fails and NO access to any apache data is
available, i.e., failure to import mod_python
2) operational module files to import and I need to send the message
to the client browser
3) import failure where a nice message is just included in the output
stream (well, I think I can figure this one out)

number 1 above seems the most problematic.


David Bear
phone: 	602-496-0424
fax: 	602-496-0955
College of Public Programs/ASU
University Center Rm 622
411 N Central
Phoenix, AZ 85007-0685
 "Beware the IP portfolio, everyone will be suspect of trespassing"

More information about the Mod_python mailing list