From 97136768f9615949e0bb2ac0878c5477bb32515e Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Mon, 6 Jun 2016 07:21:49 -0400 Subject: [PATCH] Empty the RequestCache if the request ends in an exception --- common/djangoapps/request_cache/middleware.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/common/djangoapps/request_cache/middleware.py b/common/djangoapps/request_cache/middleware.py index a3198711ea..197d637683 100644 --- a/common/djangoapps/request_cache/middleware.py +++ b/common/djangoapps/request_cache/middleware.py @@ -51,3 +51,10 @@ class RequestCache(object): def process_response(self, request, response): self.clear_request_cache() return response + + def process_exception(self, request, exception): # pylint: disable=unused-argument + """ + Clear the RequestCache after a failed request. + """ + self.clear_request_cache() + return None