On Mon, Feb 28, 2005 at 10:36:45AM +0200, Ksenia Marasanova wrote:
> If I need to execute some code at the end of every request, should I
> override all 3 functions for that?
>
> finish_successful_request
> finish_interrupted_request
> finish_failed_request
>
> Or is there a better approach?
> (in Quixote1)
I do it the following way:
def process_request(self, request, env):
from DB import transaction_commit, transaction_rollback
try:
output = Publisher.process_request(self, request, env)
self.log_access(request) # log to DB
except:
transaction_rollback()
raise
else:
transaction_commit()
return output
Catch and rereaise any error, except for errors in rollback().
Oleg.
--
Oleg Broytmann http://phd.pp.ru/ phd@phd.pp.ru
Programmers don't die, they just GOSUB without RETURN.