#NEWLINE# @ register . filter #NEWLINE# def bootstrap_message_classes( message ) : #NEWLINE# #INDENT# '\n    Return the message classes for a message\n    ' #NEWLINE# extra_tags = None #NEWLINE# try : #NEWLINE# #INDENT# extra_tags = message . extra_tags #NEWLINE# #UNINDENT# except AttributeError : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# if ( not extra_tags ) : #NEWLINE# #INDENT# extra_tags = '' #NEWLINE# #UNINDENT# classes = [ extra_tags ] #NEWLINE# try : #NEWLINE# #INDENT# level = message . level #NEWLINE# #UNINDENT# except AttributeError : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# classes . append ( MESSAGE_LEVEL_CLASSES [ level ] ) #NEWLINE# #UNINDENT# except KeyError : #NEWLINE# #INDENT# classes . append ( 'alert alert-danger' ) #NEWLINE# #UNINDENT# #UNINDENT# return ' ' . join ( classes ) . strip ( )