Bart
scarfboy at gmail.com
Wed Jan 9 19:05:53 EST 2008
On Jan 7, 2008 7:57 PM, Webb Sprague <webb.sprague at gmail.com> wrote: > > 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. Module scope is unrelated to a request. As I recall, there is no official m_p way to add something around handlers, exception handling or otherwise. This is why I suggested a decorator. For things like mod_python, it's an unobtrusive, non-code-redundant way to wrap handlers in some code anyway. (I e.g. add transparent unicode output the same way) > > 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. Why not? What are your needs, and how does it not cover them? --Bart
|