3 from forum.settings import MAINTAINANCE_MODE, APP_LOGO, APP_TITLE
5 from forum.http_responses import HttpResponseServiceUnavailable
9 class RequestUtils(object):
10 def process_request(self, request):
11 if MAINTAINANCE_MODE.value is not None and isinstance(MAINTAINANCE_MODE.value.get('allow_ips', None), list):
12 ip = request.META['REMOTE_ADDR']
14 if not ip in MAINTAINANCE_MODE.value['allow_ips']:
15 return HttpResponseServiceUnavailable(MAINTAINANCE_MODE.value.get('message', ''))
17 if request.session.get('redirect_POST_data', None):
18 request.POST = request.session.pop('redirect_POST_data')
19 request.META['REQUEST_METHOD'] = "POST"
21 self.request = request
22 forum.REQUEST_HOLDER.request = request
25 def process_response(self, request, response):
26 forum.REQUEST_HOLDER.request = None