diff options
| author | Martin Thoma <info@martin-thoma.de> | 2020-09-24 18:37:55 +0200 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2020-10-28 20:20:20 +0100 |
| commit | 302caa40e4caab7d95ef7d0a88a90f935039ab09 (patch) | |
| tree | 5508daa6533f00834203e2d38e1f02919f513636 /django/middleware/common.py | |
| parent | 4eb756793b64cf153be4fbe0411da6e3e4f1279d (diff) | |
Made small readability improvements.
Diffstat (limited to 'django/middleware/common.py')
| -rw-r--r-- | django/middleware/common.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/django/middleware/common.py b/django/middleware/common.py index 3af4759109..e42d05e255 100644 --- a/django/middleware/common.py +++ b/django/middleware/common.py @@ -104,9 +104,8 @@ class CommonMiddleware(MiddlewareMixin): """ # If the given URL is "Not Found", then check if we should redirect to # a path with a slash appended. - if response.status_code == 404: - if self.should_redirect_with_slash(request): - return self.response_redirect_class(self.get_full_path_with_slash(request)) + if response.status_code == 404 and self.should_redirect_with_slash(request): + return self.response_redirect_class(self.get_full_path_with_slash(request)) # Add the Content-Length header to non-streaming responses if not # already set. |
