#NEWLINE# def _after_request( self , response ) : #NEWLINE# #INDENT# '\n        Checks if the `flask._app_ctx_object` object contains the CSRF token,\n        and if the view in question has CSRF protection enabled. If both,\n        returns the response with a cookie containing the token. If not then we\n        just return the response unaltered. Bound to the Flask `after_request`\n        decorator.\n\n        :param response: A Flask Response object.\n        ' #NEWLINE# if ( getattr ( _app_ctx_stack . top , self . _csrf_name , None ) is None ) : #NEWLINE# #INDENT# return response #NEWLINE# #UNINDENT# _view_func = getattr ( _app_ctx_stack . top , '_view_func' , False ) #NEWLINE# if ( not ( _view_func and self . _should_use_token ( _view_func ) ) ) : #NEWLINE# #INDENT# return response #NEWLINE# #UNINDENT# csrf_token = getattr ( _app_ctx_stack . top , self . _csrf_name ) #NEWLINE# if ( session . get ( self . _csrf_name ) != csrf_token ) : #NEWLINE# #INDENT# session [ self . _csrf_name ] = csrf_token #NEWLINE# #UNINDENT# response . set_cookie ( self . _csrf_name , csrf_token , max_age = self . _csrf_timeout , secure = self . _csrf_secure , httponly = self . _csrf_httponly , domain = self . _csrf_domain ) #NEWLINE# response . vary . add ( 'Cookie' ) #NEWLINE# return response