durusmail: quixote-users: publisher.log_request()
publisher.log_request()
2004-02-23
2004-02-24
2004-02-24
Jason Sibre (2 parts)
publisher.log_request()
Jason Sibre
2004-02-23
I noticed tonight that due to the location of the call to log_request(), not
all requests are logged using Quixote's built-in logging functionality (this
doesn't apply if you're using Medusa's logging, or Apache's, etc)  404s, for
example, or anything else which results in an exception that makes it out of
the publishable, even if it's later handled by a _q_exceptionhandler, will
prevent that particular request from being logged by Qx.

This is because the self.log_request() call is in process_request(), just
after the call to try_publish().  If an exception is raised by try_publish
(which is where TraversalError, AccessError, and a host of others would come
from), it isn't caught until it makes it back out to publish, after
essentially skipping the log_request() call in process_request().

After looking at things, and noticing how
medusa_http.QuixoteHandler.continue_request() calls directly into
process_request() bypassing publish(), and publish()es 'try/except/except'
block is duplicated there, I think some refactoring may be in order.  It
looks like moving the try/except/except block from publish() to
process_request() will improve things, allowing the call to log_request() to
happen after the t/e/e block.
medusa_http.QuixoteHandler.continue_request()'s own t/e/e block could then
go away (or at least be replaced with a simpler one).

Interestingly enough, based on the comments in the code, process_request()
is where "exceptions will be handled" ...

Does anyone know if the t/e/e block used to be in process_request() and if
there was a good reason for moving it out?  The oldest copy of Quixote I
have is .5.1, and the t/e/e block is in publish(), just as it is now.

Anyone have any ideas on this?

Jason



reply