#NEWLINE# def must_be_valid_project( func = None , retractions_valid = False ) : #NEWLINE# #INDENT# ' Ensures permissions to retractions are never implicitly granted. ' #NEWLINE# def must_be_valid_project_inner( func ) : #NEWLINE# #INDENT# @ functools . wraps ( func ) #NEWLINE# def wrapped( * args , **kwargs ) : #NEWLINE# #INDENT# _inject_nodes ( kwargs ) #NEWLINE# if getattr ( kwargs [ 'node' ] , 'is_collection' , True ) : #NEWLINE# #INDENT# raise HTTPError ( http . NOT_FOUND ) #NEWLINE# #UNINDENT# if ( ( not retractions_valid ) and getattr ( kwargs [ 'node' ] . retraction , 'is_retracted' , False ) ) : #NEWLINE# #INDENT# raise HTTPError ( http . BAD_REQUEST , data = dict ( message_long = 'Viewing withdrawn registrations is not permitted' ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return func ( * args , ** kwargs ) #NEWLINE# #UNINDENT# #UNINDENT# return wrapped #NEWLINE# #UNINDENT# if func : #NEWLINE# #INDENT# return must_be_valid_project_inner ( func ) #NEWLINE# #UNINDENT# return must_be_valid_project_inner