mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-05-02 12:34:46 +00:00
Merge pull request #1684 from takeflight/refactor/blank-except
Refactor out a bare except: statement
This commit is contained in:
commit
ca92f5ede0
1 changed files with 7 additions and 8 deletions
|
|
@ -16,12 +16,11 @@ class RedirectMiddleware(object):
|
|||
# Find redirect
|
||||
try:
|
||||
redirect = models.Redirect.get_for_site(request.site).get(old_path=path)
|
||||
except models.Redirect.DoesNotExist:
|
||||
# No redirect found, return the 400 page
|
||||
return response
|
||||
|
||||
if redirect.is_permanent:
|
||||
return http.HttpResponsePermanentRedirect(redirect.link)
|
||||
else:
|
||||
return http.HttpResponseRedirect(redirect.link)
|
||||
except:
|
||||
pass
|
||||
|
||||
return response
|
||||
if redirect.is_permanent:
|
||||
return http.HttpResponsePermanentRedirect(redirect.link)
|
||||
else:
|
||||
return http.HttpResponseRedirect(redirect.link)
|
||||
|
|
|
|||
Loading…
Reference in a new issue