]> git.openstreetmap.org Git - osqa.git/blob - forum/middleware/request_utils.py
hide the navigation links in the administration if the currently authenticated user...
[osqa.git] / forum / middleware / request_utils.py
1 from forum.settings import MAINTAINANCE_MODE, APP_LOGO, APP_TITLE\r
2 \r
3 from forum.http_responses import HttpResponseServiceUnavailable\r
4 \r
5 class RequestUtils(object):\r
6     def process_request(self, request):\r
7         if MAINTAINANCE_MODE.value is not None and isinstance(MAINTAINANCE_MODE.value.get('allow_ips', None), list):\r
8             ip = request.META['REMOTE_ADDR']\r
9 \r
10             if not ip in MAINTAINANCE_MODE.value['allow_ips']:\r
11                 return HttpResponseServiceUnavailable(MAINTAINANCE_MODE.value.get('message', ''))\r
12 \r
13         if request.session.get('redirect_POST_data', None):\r
14             request.POST = request.session.pop('redirect_POST_data')\r
15             request.META['REQUEST_METHOD'] = "POST"\r
16 \r
17         self.request = request\r
18         return None