#NEWLINE# def _set( self , module , key , value , action = 'set' , is_cdp = False , multiple_file = False ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# self . ConfigArray [ module ] #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# conf = self . ConfigArray [ module ] #NEWLINE# if ( type ( key ) == list ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( type ( key ) == str ) : #NEWLINE# #INDENT# key = [ key ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# #UNINDENT# new_key = [ ] #NEWLINE# for _k in key : #NEWLINE# #INDENT# new_key . append ( _k . replace ( "'" , "\\'" ) ) #NEWLINE# #UNINDENT# if ( is_cdp is False ) : #NEWLINE# #INDENT# eval_str = 'conf' #NEWLINE# cnt = 0 #NEWLINE# for _k in key : #NEWLINE# #INDENT# _k = _k . replace ( "'" , "\\'" ) #NEWLINE# eval_str = ( "%s['%s']" % ( eval_str , _k ) ) #NEWLINE# try : #NEWLINE# #INDENT# exec ( ( '%s' % ( eval_str , ) ) ) #NEWLINE# try : #NEWLINE# #INDENT# exec ( ( "%s['action'] = '%s'" % ( eval_str , str ( action ) ) ) ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# except : #NEWLINE# #INDENT# val_str = "{'value':{},'action':action,'comment':False}" #NEWLINE# exec ( ( '%s = %s' % ( eval_str , val_str ) ) ) #NEWLINE# #UNINDENT# eval_str = ( "%s['value']" % ( eval_str , ) ) #NEWLINE# try : #NEWLINE# #INDENT# exec ( ( '%s' % ( eval_str , ) ) ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# val_str = '{}' #NEWLINE# exec ( ( '%s = %s' % ( eval_str , val_str ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# eval_str = ( "conf['%s']" % "']['value']['" . join ( new_key ) ) #NEWLINE# eval_str_value = ( "%s['value']" % eval_str ) #NEWLINE# exec ( ( '%s = value' % ( eval_str_value , ) ) ) #NEWLINE# self . ConfigArray [ module ] = conf #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# k_len = len ( new_key ) #NEWLINE# is_dict = True #NEWLINE# eval_str_value = 'conf' #NEWLINE# if ( multiple_file is True ) : #NEWLINE# #INDENT# file_name = new_key . pop ( 0 ) #NEWLINE# eval_str = ( eval_str_value + ( "['%s']" % file_name ) ) #NEWLINE# eval_str_value += ( "['%s']['value']" % file_name ) #NEWLINE# try : #NEWLINE# #INDENT# exec ( ( '%s' % ( eval_str_value , ) ) ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# exec ( ( '%s' % ( eval_str , ) ) ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# val_str = '{}' #NEWLINE# exec ( ( '%s = %s' % ( eval_str , val_str ) ) ) #NEWLINE# #UNINDENT# val_str = '{}' #NEWLINE# exec ( ( '%s = %s' % ( eval_str_value , val_str ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# cnt = 0 #NEWLINE# for _k in new_key : #NEWLINE# #INDENT# eval_str_value += ( "['%s']" % _k ) #NEWLINE# try : #NEWLINE# #INDENT# exec ( ( '%s' % ( eval_str_value , ) ) ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# val_str = '{}' #NEWLINE# exec ( ( '%s = %s' % ( eval_str_value , val_str ) ) ) #NEWLINE# #UNINDENT# eval_str_value_base = eval_str_value #NEWLINE# eval_str_value += "['value']" #NEWLINE# try : #NEWLINE# #INDENT# exec ( ( '%s' % ( eval_str_value , ) ) ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# if ( is_dict is False ) : #NEWLINE# #INDENT# val_str = "{'value':[{},[[],None]],'action':action,'comment':False}" #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# val_str = "{'value':{},'action':action,'comment':False}" #NEWLINE# #UNINDENT# exec ( ( '%s = %s' % ( eval_str_value_base , val_str ) ) ) #NEWLINE# #UNINDENT# if ( is_dict is False ) : #NEWLINE# #INDENT# eval_str_value += '[0]' #NEWLINE# if ( cnt == k_len ) : #NEWLINE# #INDENT# exec ( ( '%s = value' % ( eval_str_value , ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# is_dict = ( not is_dict ) #NEWLINE# cnt = ( cnt + 1 ) #NEWLINE# #UNINDENT# exec ( ( '%s = value' % ( eval_str_value , ) ) ) #NEWLINE# self . ConfigArray [ module ] = conf #NEWLINE# #UNINDENT# return True