#NEWLINE# def account_required( self , view ) : #NEWLINE# #INDENT# 'Wraps a view function to allow access only to users with valid accounts and otherwise redirect them to the :meth:`account_view`.' #NEWLINE# def inner( request , * args , **kwargs ) : #NEWLINE# #INDENT# if ( not self . has_valid_account ( request . user ) ) : #NEWLINE# #INDENT# messages . add_message ( request , messages . ERROR , 'You need to add some account information before you can access that page.' , fail_silently = True ) #NEWLINE# if self . manage_account_page : #NEWLINE# #INDENT# self . set_requirement_redirect ( request , redirect = request . path ) #NEWLINE# redirect = self . reverse ( 'account' , node = request . node ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# redirect = request . node . get_absolute_url ( ) #NEWLINE# #UNINDENT# return HttpResponseRedirect ( redirect ) #NEWLINE# #UNINDENT# return view ( request , * args , ** kwargs ) #NEWLINE# #UNINDENT# inner = self . login_required ( self ) #NEWLINE# return inner