1 from forum.settings import MAINTAINANCE_MODE, APP_LOGO, APP_TITLE
3 from forum.http_responses import HttpResponseServiceUnavailable
5 class RequestUtils(object):
6 def process_request(self, request):
7 if MAINTAINANCE_MODE.value is not None and isinstance(MAINTAINANCE_MODE.value.get('allow_ips', None), list):
8 ip = request.META['REMOTE_ADDR']
10 if not ip in MAINTAINANCE_MODE.value['allow_ips']:
11 return HttpResponseServiceUnavailable(MAINTAINANCE_MODE.value.get('message', ''))
13 if request.session.get('redirect_POST_data', None):
14 request.POST = request.session.pop('redirect_POST_data')
15 request.META['REQUEST_METHOD'] = "POST"
17 self.request = request