Add docstring to middleware hooks
authorSverre Rabbelier <srabbelier@gmail.com>
Sat, 12 Sep 2009 14:42:37 +0200
changeset 2906 6fb53ed7aff4
parent 2905 378833eb5a95
child 2907 fbf0d63f37b9
Add docstring to middleware hooks
app/soc/middleware/exception_handler.py
app/soc/middleware/maintenance.py
app/soc/middleware/value_store.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)
 
--- 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)
--- 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)