From dd28a845db359a54dd7fcd070f3dd69aecfc5b33 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Thu, 28 May 2015 13:22:42 -0400 Subject: [PATCH] Fix NPE in cache control decorator --- util/cache.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/util/cache.py b/util/cache.py index 20c1a97c8..13c0949de 100644 --- a/util/cache.py +++ b/util/cache.py @@ -29,6 +29,7 @@ def no_cache(f): @wraps(f) def add_no_cache(*args, **kwargs): response = f(*args, **kwargs) - response.headers['Cache-Control'] = 'no-cache, no-store, must-revalidate' + if response is not None: + response.headers['Cache-Control'] = 'no-cache, no-store, must-revalidate' return response return add_no_cache