#NEWLINE# def delete( self , module , key , is_cdp = False , multiple_file = False ) : #NEWLINE# #INDENT# retval = False #NEWLINE# try : #NEWLINE# #INDENT# self . ConfigArray [ module ] #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# return retval #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 retval #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['%s']" % "']['value']['" . join ( new_key ) ) #NEWLINE# eval_str_value = ( "%s['value']" % eval_str ) #NEWLINE# try : #NEWLINE# #INDENT# exec ( ( '%s' % ( eval_str , ) ) ) #NEWLINE# eval_str_action = ( "%s['action']" % eval_str ) #NEWLINE# exec ( ( "%s = 'delete'" % ( eval_str_action , ) ) ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# self . ConfigArray [ module ] = conf #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# is_dict = True #NEWLINE# eval_str = 'conf' #NEWLINE# if ( multiple_file is True ) : #NEWLINE# #INDENT# eval_str += ( "['%s']['value']" % new_key . pop ( 0 ) ) #NEWLINE# #UNINDENT# k_len = len ( new_key ) #NEWLINE# cnt = 0 #NEWLINE# for _k in new_key : #NEWLINE# #INDENT# cnt = ( cnt + 1 ) #NEWLINE# eval_str += ( "['%s']" % new_key ) #NEWLINE# if ( cnt == k_len ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# eval_str += "['value']" #NEWLINE# if ( is_dict is False ) : #NEWLINE# #INDENT# eval_str += '[0]' #NEWLINE# #UNINDENT# is_dict = ( not is_dict ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# exec ( ( '%s' % ( eval_str , ) ) ) #NEWLINE# eval_str_action = ( "%s['action']" % eval_str ) #NEWLINE# exec ( ( "%s = 'delete'" % ( eval_str_action , ) ) ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# self . ConfigArray [ module ] = conf #NEWLINE# #UNINDENT# return True