#NEWLINE# def add_message( request , level , message , extra_tags = '' , fail_silently = False ) : #NEWLINE# #INDENT# "Attempts to add a message to the request using the 'messages' app." #NEWLINE# if ( not horizon_message_already_queued ( request , message ) ) : #NEWLINE# #INDENT# if request . is_ajax ( ) : #NEWLINE# #INDENT# tag = constants . DEFAULT_TAGS [ level ] #NEWLINE# if isinstance ( message , SafeData ) : #NEWLINE# #INDENT# extra_tags = ( extra_tags + ' safe' ) #NEWLINE# #UNINDENT# request . horizon [ 'async_messages' ] . append ( [ tag , force_text ( message ) , tag ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return _messages . add_message ( request , level , message , extra_tags , fail_silently )