#NEWLINE# def inject_config( consumer , properties ) : #NEWLINE# #INDENT# for prop in properties : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# if ( ':' in prop ) : #NEWLINE# #INDENT# ( property_name , value ) = ( prop . split ( ':' ) [ 1 ] , _section_value_map [ prop ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# ( property_name , value ) = ( prop , _value_map [ prop ] ) #NEWLINE# #UNINDENT# #UNINDENT# except KeyError : #NEWLINE# #INDENT# log . error ( 'No value found for configuration value {} in consumer {}' , prop , consumer . __name__ ) #NEWLINE# continue #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# old_value = getattr ( consumer , property_name ) #NEWLINE# if ( properties == value ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# log . info ( 'Updating config {} from {} to {} in {}.' , property_name , old_value , value , consumer . __name__ ) #NEWLINE# #UNINDENT# except AttributeError : #NEWLINE# #INDENT# log . info ( 'Setting config {}: {} in {}.' , property_name , value , consumer . __name__ ) #NEWLINE# #UNINDENT# setattr ( consumer , property_name , value ) #NEWLINE# #UNINDENT# if hasattr ( consumer , '_on_configured' ) : #NEWLINE# #INDENT# consumer . _on_configured ( )