Skip to content

Commit

Permalink
Merge pull request #143 from benchling/master
Browse files Browse the repository at this point in the history
Fix CsrfProtect exempt for blueprints
  • Loading branch information
lepture committed Aug 20, 2014
2 parents 57f0823 + bca563f commit c3717f3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions flask_wtf/csrf.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def _csrf_protect():
if request.method in ('GET', 'HEAD', 'OPTIONS', 'TRACE'):
return

if self._exempt_views:
if self._exempt_views or self._exempt_blueprints:
if not request.endpoint:
return

Expand All @@ -165,7 +165,7 @@ def _csrf_protect():
dest = '%s.%s' % (view.__module__, view.__name__)
if dest in self._exempt_views:
return
if view.__module__ in self._exempt_blueprints:
if request.blueprint in self._exempt_blueprints:
return

csrf_token = None
Expand Down Expand Up @@ -211,7 +211,7 @@ def some_view():
return
"""
if isinstance(view, Blueprint):
self._exempt_blueprints.add(view.import_name)
self._exempt_blueprints.add(view.name)
return view
if isinstance(view, string_types):
view_location = view
Expand Down

0 comments on commit c3717f3

Please sign in to comment.