Merge pull request #1684 from takeflight/refactor/blank-except

Refactor out a bare except: statement
This commit is contained in:
Karl Hobley 2015-09-16 09:08:53 +01:00
commit ca92f5ede0

View file

@ -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)