<s> """<STR_LIT>""" <EOL> from django . contrib import messages as _messages <EOL> from django . contrib . messages import constants <EOL> from django . utils . encoding import force_unicode <EOL> from django . utils . safestring import SafeData <EOL> def add_message ( request , level , message , extra_tags = '<STR_LIT>' , fail_silently = False ) : <EOL> """<STR_LIT>""" <EOL> if request . is_ajax ( ) : <EOL> tag = constants . DEFAULT_TAGS [ level ] <EOL> if isinstance ( message , SafeData ) : <EOL> extra_tags = extra_tags + '<STR_LIT>' <EOL> request . horizon [ '<STR_LIT>' ] . append ( [ tag , <EOL> force_unicode ( message ) , <EOL> extra_tags ] ) <EOL> else : <EOL> return _messages . add_message ( request , level , message , <EOL> extra_tags , fail_silently ) <EOL> def debug ( request , message , extra_tags = '<STR_LIT>' , fail_silently = False ) : <EOL> """<STR_LIT>""" <EOL> add_message ( request , constants . DEBUG , message , extra_tags = extra_tags , <EOL> fail_silently = fail_silently ) <EOL> def info ( request , message , extra_tags = '<STR_LIT>' , fail_silently = False ) : <EOL> """<STR_LIT>""" <EOL> add_message ( request , constants . INFO , message , extra_tags = extra_tags , <EOL> fail_silently = fail_silently ) <EOL> def success ( request , message , extra_tags = '<STR_LIT>' , fail_silently = False ) : <EOL> """<STR_LIT>""" <EOL> add_message ( request , constants . SUCCESS , message , extra_tags = extra_tags , <EOL> fail_silently = fail_silently ) <EOL> def warning ( request , message , extra_tags = '<STR_LIT>' , fail_silently = False ) : <EOL> """<STR_LIT>""" <EOL> add_message ( request , constants . WARNING , message , extra_tags = extra_tags , <EOL> fail_silently = fail_silently ) <EOL> def error ( request , message , extra_tags = '<STR_LIT>' , fail_silently = False ) : <EOL> """<STR_LIT>""" <EOL> add_message ( request , constants . ERROR , message , extra_tags = extra_tags , <EOL> fail_silently = fail_silently ) </s>
