durusmail: quixote-users: mod_python_handler crashes when logging errors
mod_python_handler crashes when logging errors
2004-09-07
2004-09-07
2004-09-07
mod_python_handler crashes when logging errors
Neil Schemenauer
2004-09-07
This is from a Debian bug filed b Philip Stadermann
.  Can any mod_python users verify
the patch?

  Neil


==========================================================================

I'm using quixote with mod_python. When I access a script with an error
I get the following response:


Mod_python error: "PythonHandler quixote.mod_python_handler"

Traceback (most recent call last):

  File "/usr/lib/python2.3/site-packages/mod_python/apache.py", line 193, in
Dispatch
    result = object(req)

  File "/usr/lib/python2.3/site-packages/quixote/mod_python_handler.py", line
81, in handler
    return pub.publish_modpython(req)

  File "/usr/lib/python2.3/site-packages/quixote/mod_python_handler.py", line
50, in publish_modpython
    apache.build_cgi_env(req))

  File "/usr/lib/python2.3/site-packages/quixote/publish.py", line 541, in
publish
    output = self.process_request(request, env)

  File "/usr/lib/python2.3/site-packages/quixote/publish.py", line 528, in
process_request
    output = self.finish_failed_request(request)

  File "/usr/lib/python2.3/site-packages/quixote/publish.py", line 373, in
finish_failed_request
    self.log("exception caught")

  File "/usr/lib/python2.3/site-packages/quixote/mod_python_handler.py", line
34, in log
    self.__apache_request.log_error(msg)

  File "/usr/lib/python2.3/site-packages/mod_python/apache.py", line 85, in
__getattr__
    raise AttributeError, attr

AttributeError: log_error



I couldn't find a log_error method for the request object in the mod_python
documentation. The following patch fixes the error for me:

--- /usr/lib/python2.3/site-packages/quixote/mod_python_handler.py
2004-04-23 15:24:56.000000000 +0200
+++ mod_python_handler.py       2004-09-07 20:53:39.000000000 +0200
@@ -30,10 +30,11 @@

     def log(self, msg):
         if self.error_log is self.__error_log:
-            if self.__apache_request:
-                self.__apache_request.log_error(msg)
-            else:
-                apache.log_error(msg)
+            #if self.__apache_request:
+            #    self.__apache_request.log_error(msg)
+            #else:
+            #    apache.log_error(msg)
+            apache.log_error(msg)
         else:
             Publisher.log(self, msg)


__apache_request isn't used anywhere else, so it can probably removed
completely.

reply