VirtualMailManager/cli/Config.py
branchv0.6.x
changeset 215 33f727efa7c4
parent 206 da07dd944ad1
child 216 0c8c053b451c
equal deleted inserted replaced
214:84e6e898e6c5 215:33f727efa7c4
    29         iterable ``sections`` object."""
    29         iterable ``sections`` object."""
    30         input_fmt = _(u'Enter new value for option %(option)s \
    30         input_fmt = _(u'Enter new value for option %(option)s \
    31 [%(current_value)s]: ')
    31 [%(current_value)s]: ')
    32         failures = 0
    32         failures = 0
    33 
    33 
    34         w_std(_(u'Using configuration file: %s\n') % self._cfgFileName)
    34         w_std(_(u'Using configuration file: %s\n') % self._cfg_filename)
    35         for s in sections:
    35         for s in sections:
    36             w_std(_(u'* Configuration section: %r') % s)
    36             w_std(_(u'* Configuration section: %r') % s)
    37             for opt, val in self.items(s):
    37             for opt, val in self.items(s):
    38                 failures = 0
    38                 failures = 0
    39                 while True:
    39                 while True:
    80         RawConfigParser.set(self, section, option_, val)
    80         RawConfigParser.set(self, section, option_, val)
    81         self.__saveChanges()
    81         self.__saveChanges()
    82 
    82 
    83     def __saveChanges(self):
    83     def __saveChanges(self):
    84         """Writes changes to the configuration file."""
    84         """Writes changes to the configuration file."""
    85         copy2(self._cfgFileName, self._cfgFileName + '.bak')
    85         copy2(self._cfg_filename, self._cfg_filename + '.bak')
    86         self._cfgFile = open(self._cfgFileName, 'w')
    86         self._cfg_file = open(self._cfg_filename, 'w')
    87         self.write(self._cfgFile)
    87         self.write(self._cfg_file)
    88         self._cfgFile.close()
    88         self._cfg_file.close()