def process_request(self, request): """ Checks whether updates are required and returns the appropriate response if they are. """ path_info = request.META['PATH_INFO'] if (check_updates_required() and not path_info.startswith(settings.MEDIA_URL)): return manual_updates_required(request) # Let another handler handle this. return None
def process_view(self, request, view_func, view_args, view_kwargs): """ Checks whether updates are required and returns the appropriate response if they are. """ path_info = request.META['PATH_INFO'] updates_required = check_updates_required() if updates_required and not path_info.startswith(self.ALLOWED_PATHS): return manual_updates_required(request, updates_required) # Let another handler handle this. return None
def process_view(self, request, view_func, view_args, view_kwargs): """Check whether updates are required. This returns the appropriate response if any updates are required, otherwise it allows the normal code to run. """ path_info = request.META['PATH_INFO'] updates_required = check_updates_required() if updates_required and not path_info.startswith(self.ALLOWED_PATHS): return manual_updates_required(request, updates_required) # Let another handler handle this. return None
def middleware(request): """Check whether updates are required. This returns the appropriate response if any updates are required, otherwise it allows the normal code to run. Args: request (django.http.HttpRequest): The HTTP request from the client. Returns: django.http.HttpResponse: The response object. """ path_info = request.META['PATH_INFO'] updates_required = check_updates_required() if updates_required and not path_info.startswith(ALLOWED_PATHS): return manual_updates_required(request, updates_required) return get_response(request)