mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-28 00:07:57 -05:00
error_mapper: Don't redirect to ErrorController for pagecached errors.
This prevents a situation where we get a cached error (e.g. a 404) back from the pagecache and then the error_mapper (called by the ErrorDocuments middleware) sees that status code and redirects the app to the ErrorController which then re-renders the error and inserts it into the pagecache at the end of the request.
This commit is contained in:
@@ -57,12 +57,15 @@ webob.util.status_reasons[429] = HTTPTooManyRequests.title
|
||||
|
||||
#from pylons.middleware import error_mapper
|
||||
def error_mapper(code, message, environ, global_conf=None, **kw):
|
||||
from pylons import c
|
||||
if environ.get('pylons.error_call'):
|
||||
return None
|
||||
else:
|
||||
environ['pylons.error_call'] = True
|
||||
|
||||
from pylons import c
|
||||
if c.used_cache:
|
||||
return
|
||||
|
||||
if global_conf is None:
|
||||
global_conf = {}
|
||||
codes = [304, 400, 401, 403, 404, 409, 415, 429, 503]
|
||||
|
||||
Reference in New Issue
Block a user