From e3ff099389fa7276f03acb4a6511b378ffe540a6 Mon Sep 17 00:00:00 2001 From: Todd Wolfson Date: Thu, 28 Jan 2016 16:41:46 -0600 Subject: [PATCH] Relocated exemption checks for 404 outside of conditional --- flask_wtf/csrf.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/flask_wtf/csrf.py b/flask_wtf/csrf.py index 45877615..a885902c 100644 --- a/flask_wtf/csrf.py +++ b/flask_wtf/csrf.py @@ -165,14 +165,14 @@ def _csrf_protect(): if request.method not in app.config['WTF_CSRF_METHODS']: return - if self._exempt_views or self._exempt_blueprints: - if not request.endpoint: - return + if not request.endpoint: + return - view = app.view_functions.get(request.endpoint) - if not view: - return + view = app.view_functions.get(request.endpoint) + if not view: + return + if self._exempt_views or self._exempt_blueprints: dest = '%s.%s' % (view.__module__, view.__name__) if dest in self._exempt_views: return