#NEWLINE# def cms_perms( func ) : #NEWLINE# #INDENT# def inner( request , * args , **kwargs ) : #NEWLINE# #INDENT# page = request . current_page #NEWLINE# if page : #NEWLINE# #INDENT# if ( page . login_required and ( not request . user . is_authenticated ( ) ) ) : #NEWLINE# #INDENT# return redirect_to_login ( urlquote ( request . get_full_path ( ) ) , settings . LOGIN_URL ) #NEWLINE# #UNINDENT# if ( not page . has_view_permission ( request ) ) : #NEWLINE# #INDENT# return _handle_no_page ( request , '$' ) #NEWLINE# #UNINDENT# #UNINDENT# return func ( request , * args , ** kwargs ) #NEWLINE# #UNINDENT# inner . __module__ = func . __module__ #NEWLINE# inner . __doc__ = func . __doc__ #NEWLINE# if hasattr ( func , '__name__' ) : #NEWLINE# #INDENT# inner . __name__ = func . __name__ #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if hasattr ( func , '__class__' ) : #NEWLINE# #INDENT# inner . __name__ = func . __class__ . __name__ #NEWLINE# #UNINDENT# #UNINDENT# return func