# HG changeset patch # User Sverre Rabbelier # Date 1252759357 -7200 # Node ID 6fb53ed7aff45265686a02f8852b02d1d9c89a00 # Parent 378833eb5a95569e244645a54aa3010575c766fe Add docstring to middleware hooks diff -r 378833eb5a95 -r 6fb53ed7aff4 app/soc/middleware/exception_handler.py --- a/app/soc/middleware/exception_handler.py Sat Sep 12 14:38:42 2009 +0200 +++ b/app/soc/middleware/exception_handler.py Sat Sep 12 14:42:37 2009 +0200 @@ -38,6 +38,12 @@ """ def process_exception(self, request, exception): + """Called when an uncaught exception is raised. + + See the Django middleware documentation for an explanation of + the method signature. + """ + template = None context = responses.getUniversalContext(request) diff -r 378833eb5a95 -r 6fb53ed7aff4 app/soc/middleware/maintenance.py --- a/app/soc/middleware/maintenance.py Sat Sep 12 14:38:42 2009 +0200 +++ b/app/soc/middleware/maintenance.py Sat Sep 12 14:42:37 2009 +0200 @@ -64,12 +64,24 @@ return responses.respond(request, template, context=context) def process_request(self, request): + """Called when a request is made. + + See the Django middleware documentation for an explanation of + the method signature. + """ + context = responses.getUniversalContext(request) if not context['is_admin'] and context['in_maintenance']: return self.maintenance(request) def process_exception(self, request, exception): + """Called when an uncaught exception is raised. + + See the Django middleware documentation for an explanation of + the method signature. + """ + if isinstance(exception, CapabilityDisabledError): # assume the site is in maintenance if we get CDE return maintenance(request) diff -r 378833eb5a95 -r 6fb53ed7aff4 app/soc/middleware/value_store.py --- a/app/soc/middleware/value_store.py Sat Sep 12 14:38:42 2009 +0200 +++ b/app/soc/middleware/value_store.py Sat Sep 12 14:42:37 2009 +0200 @@ -50,11 +50,28 @@ core.endRequest(request) def process_request(self, request): + """Called when a request is made. + + See the Django middleware documentation for an explanation of + the method signature. + """ self.start(request) def process_response(self, request, response): + """Called when a response is returned. + + See the Django middleware documentation for an explanation of + the method signature. + """ + self.end(request) return response def process_exception(self, request, exception): + """Called when an uncaught exception is raised. + + See the Django middleware documentation for an explanation of + the method signature. + """ + self.end(request)