#NEWLINE# def add_msg( self , level , msg , multiline = False ) : #NEWLINE# #INDENT# "\n        Add message into result\n        Empty messages are skipped\n\n        multiline - don't split message lines into\n            multiple messages\n        " #NEWLINE# if ( not messages . result [ 'messages' ] ) : #NEWLINE# #INDENT# self . result [ 'messages' ] = { #NEWLINE# #INDENT# 'info' : [ ] , #NEWLINE# 'error' : [ ] , #NEWLINE# 'warn' : [ ] , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# if ( not multiline ) : #NEWLINE# #INDENT# messages = str ( msg ) . split ( '\n' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# messages = [ str ( msg ) ] #NEWLINE# #UNINDENT# for message in messages : #NEWLINE# #INDENT# if ( not str ( msg ) . strip ( ) ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# self . result [ 'messages' ] [ level ] . append ( str ( message ) . strip ( ) ) #NEWLINE# #UNINDENT# except KeyError : #NEWLINE# #INDENT# raise InvalidArgument ( 'Level has to be info, error or warn' )