Exemplo n.º 1
0
    def process_request(self, request):
        if api.MAINTENANCE_URL == request.path:
            return None

        if request.path in api.BYPASSED_URLS:
            return None

        bypass_value = request.COOKIES.get('django_maintenance_bypass_cookie')

        if bypass_value and self.setting_value and \
                bypass_value == self.setting_value:
            return None

        status = api.status()

        if status == api.STATUS.OFFLINE:
            return self.redirect(api.STATUS.OFFLINE)

        if status == api.STATUS.PENDING:
            engine = import_module(settings.SESSION_ENGINE)
            session_key = request.COOKIES.get(settings.SESSION_COOKIE_NAME, None)
            session = engine.SessionStore()
            if session.exists(session_key):
                return None
            else:
                return self.redirect(api.STATUS.PENDING)

        return None
Exemplo n.º 2
0
    def process_request(self, request):
        if api.MAINTENANCE_URL == request.path:
            return None

        if request.path in api.BYPASSED_URLS:
            return None

        bypass_value = request.COOKIES.get('django_maintenance_bypass_cookie')

        if bypass_value and self.setting_value and \
                bypass_value == self.setting_value:
            return None

        status = api.status()

        if status == api.STATUS.OFFLINE:
            return self.redirect(api.STATUS.OFFLINE)

        if status == api.STATUS.PENDING:
            engine = import_module(settings.SESSION_ENGINE)
            session_key = request.COOKIES.get(settings.SESSION_COOKIE_NAME,
                                              None)
            session = engine.SessionStore()
            if session.exists(session_key):
                return None
            else:
                return self.redirect(api.STATUS.PENDING)

        return None
    def process_request(self, request):
        if api.MAINTENANCE_URL == request.path:
            return None

        status = api.status()

        if status == api.STATUS.OFFLINE:
            return self.redirect(api.STATUS.OFFLINE)

        if status == api.STATUS.PENDING:
            engine = import_module(settings.SESSION_ENGINE)
            session_key = request.COOKIES.get(settings.SESSION_COOKIE_NAME, None)
            session = engine.SessionStore()
            if session.exists(session_key):
                return None
            else:
                return self.redirect(api.STATUS.PENDING)

        return None
Exemplo n.º 4
0
    def process_request(self, request):
        if api.MAINTENANCE_URL == request.path:
            return None

        status = api.status()

        if status == api.STATUS.OFFLINE:
            return self.redirect(api.STATUS.OFFLINE)

        if status == api.STATUS.PENDING:
            engine = import_module(settings.SESSION_ENGINE)
            session_key = request.COOKIES.get(settings.SESSION_COOKIE_NAME,
                                              None)
            session = engine.SessionStore()
            if session.exists(session_key):
                return None
            else:
                return self.redirect(api.STATUS.PENDING)

        return None
def maintenance():
    return {'maintenance_status': api.status()}
Exemplo n.º 6
0
def maintenance():
    return {'maintenance_status': api.status()}