def exempt(self, view):
"""A decorator that can exclude a view from csrf protection.
Remember to put the decorator above the `route`::
csrf = CsrfProtect(app)
@csrf.exempt
@app.route('/some-view', methods=['POST'])
def some_view():
return
"""
if isinstance(view, Blueprint):
self._exempt_blueprints.add(view.name)
return view
if isinstance(view, string_types):
view_location = view
else:
view_location = '%s.%s' % (view.__module__, view.__name__)
self._exempt_views.add(view_location)
return view
评论列表
文章目录