Issue 653: Don't throw exception if response has no vary header.
authorNathan Yergler <nathan@yergler.net>
Sun, 13 Nov 2011 19:41:43 +0000 (11:41 -0800)
committerNathan Yergler <nathan@yergler.net>
Sun, 13 Nov 2011 19:41:43 +0000 (11:41 -0800)
mediagoblin/middleware/csrf.py

index 7a5e352e8e88a808431a9d5cf6faf34cfea8101c..6c977f21a5e7c3a92988aa64ddcb2981eba4cf36 100644 (file)
@@ -98,7 +98,7 @@ class CsrfMiddleware(object):
             httponly=True)
 
         # update the Vary header
-        response.vary = (response.vary or []) + ['Cookie']
+        response.vary = getattr(response, 'vary', []) + ['Cookie']
 
     def _make_token(self, request):
         """Generate a new token to use for CSRF protection."""