diff --git a/django/contrib/flatpages/middleware.py b/django/contrib/flatpages/middleware.py
index fb98c39..869e1cb 100644
|
a
|
b
|
class FlatpageFallbackMiddleware(object):
|
| 7 | 7 | if response.status_code != 404: |
| 8 | 8 | return response # No need to check for a flatpage for non-404 responses. |
| 9 | 9 | try: |
| 10 | | return flatpage(request, request.path_info) |
| | 10 | res = flatpage(request, request.path_info) |
| 11 | 11 | # Return the original response if any errors happened. Because this |
| 12 | 12 | # is a middleware, we can't assume the errors will be caught elsewhere. |
| 13 | 13 | except Http404: |
| 14 | | return response |
| | 14 | res = response |
| 15 | 15 | except: |
| 16 | 16 | if settings.DEBUG: |
| 17 | 17 | raise |
| 18 | | return response |
| | 18 | res = response |
| | 19 | else: |
| | 20 | response.status_code = 200 |
| | 21 | |
| | 22 | return res |