Fwd: [mod_python] Exceptions in the mod_python handler?

Webb Sprague webb.sprague at gmail.com
Mon Jan 7 16:59:04 EST 2008


whoops - meant to send to list


---------- Forwarded message ----------
From: Webb Sprague <webb.sprague at gmail.com>
Date: Jan 7, 2008 10:57 AM
Subject: Re: [mod_python] Exceptions in the mod_python handler?
To: Bart <scarfboy at gmail.com>


> The stack trace comes from PythonDebug being On, as you probably know.
> You can turn it off and raise an error that causes apache to generate its
> generic error page (for the HTTP code), but this is probably no more
> informative.
> Since you'll probably want something app-specific, you'll probably want to
> catch the error inside python and generate your own error page.

Exactly -- within module scope of the page handler, how does one catch
an exception and print something to the user through the apache
socket?  I don't have a "req" because I am not within a function
(rather in module scope only), so I can't call req.write(), and
vanilla  print doesn't print to the apache socket.

So, unfortunately, my question remains.

> Leaving connections open between page loads is technically possible,
> but opens a world of worry and bordercases.
> As I recall, psycopg does connection pooling anyway, so I'd suggest
> reading up on how to use it.

I will investigate, but I don't think this is the answer, really.

-W


More information about the Mod_python mailing list