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
Shahms King
2004-09-07
The patch will "work" but is not correct for newer versions of
mod_python.  I suspect Debian must still be using the (over two year
old) 2.7.8 version of mod_python.  Which, aside from being ancient,
doesn't have support for the per-request log_error method.  The current
version of mod_python has request.log_error documented in two places as
the preferred method when a request object is available.  Below is a
hand-edited version of the patch which works around the older version
without disabling the functionality for newer versions.

--- /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,10 @@

     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)
+            try:
+                self.__apache_request.log_error(msg)
+            except AttributeError:
+                apache.log_error(msg)
         else:
             Publisher.log(self, msg)


--
Shahms E. King 
Multnomah ESD

Public Key:
http://shahms.mesd.k12.or.us/~sking/shahms.asc
Fingerprint:
1612 054B CE92 8770 F1EA  AB1B FEAB 3636 45B2 D75B
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQBBPix7/qs2NkWy11sRAokgAJ9P8I5MxW3comRww8OTJ3/3+kA3jgCfbQwM
AsHx9w7Cl+QKlA7N3d2nxZs=
=3rBO
-----END PGP SIGNATURE-----
reply