示例#1
0
    def process_request(self, request):
        if self.enabled:
            if not request_is_secure(request):
                if request_requires_secure(request, self.paths):
                    return redirect_secure(request)

            if request_is_secure(request):
                if not request_requires_secure(request, self.paths):
                    return redirect_insecure(request)
        else:
            return None
示例#2
0
    def _wrapped_view_func(request, *args, **kwargs):
        if not request.is_secure():
            if not request_is_secure(request):
                return redirect_secure(request)

        return view_func(request, *args, **kwargs)