]> git.openstreetmap.org Git - osqa.git/commitdiff
Simple method to hold the current request for special cases.
authorhernani <hernani@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Fri, 30 Sep 2011 11:36:17 +0000 (11:36 +0000)
committerhernani <hernani@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Fri, 30 Sep 2011 11:36:17 +0000 (11:36 +0000)
git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@1180 0cfe37f9-358a-4d5e-be75-b63607b5c754

forum/__init__.py
forum/middleware/request_utils.py

index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..51c0c431c26bb68ed2ccf20fd1374e6a2239938d 100644 (file)
@@ -0,0 +1,5 @@
+class RequestHolder(object):
+    def __init__(self):
+        self.request = None
+
+REQUEST_HOLDER = RequestHolder()
\ No newline at end of file
index e3b5bc25116569f6122f11b19ced94d5c7dc8280..e90d3c52c2f9b0dbda3274a2b8076f3ee244aca0 100644 (file)
@@ -1,7 +1,11 @@
+import forum
+
 from forum.settings import MAINTAINANCE_MODE, APP_LOGO, APP_TITLE
 
 from forum.http_responses import HttpResponseServiceUnavailable
 
+
+
 class RequestUtils(object):
     def process_request(self, request):
         if MAINTAINANCE_MODE.value is not None and isinstance(MAINTAINANCE_MODE.value.get('allow_ips', None), list):
@@ -15,4 +19,10 @@ class RequestUtils(object):
             request.META['REQUEST_METHOD'] = "POST"
 
         self.request = request
-        return None
\ No newline at end of file
+        forum.REQUEST_HOLDER.request = request
+        return None
+
+    def process_response(selfself, request, response):
+        forum.REQUEST_HOLDER.request = None
+        return response
+