VirtualMailManager/cli/config.py
branchv0.6.x
changeset 349 d60ffbc0124b
parent 344 0d2430dc6ef8
child 366 d6573da35b5f
equal deleted inserted replaced
348:ca7575401549 349:d60ffbc0124b
    11 from ConfigParser import RawConfigParser
    11 from ConfigParser import RawConfigParser
    12 from shutil import copy2
    12 from shutil import copy2
    13 
    13 
    14 from VirtualMailManager import ENCODING
    14 from VirtualMailManager import ENCODING
    15 from VirtualMailManager.config import Config, ConfigValueError, LazyConfig
    15 from VirtualMailManager.config import Config, ConfigValueError, LazyConfig
    16 from VirtualMailManager.errors import ConfigError
    16 from VirtualMailManager.errors import ConfigError, VMMError
    17 from VirtualMailManager.cli import w_err, w_std
    17 from VirtualMailManager.cli import w_err, w_std
    18 from VirtualMailManager.constants import CONF_ERROR, VMM_TOO_MANY_FAILURES
    18 from VirtualMailManager.constants import CONF_ERROR, VMM_TOO_MANY_FAILURES
    19 
    19 
    20 _ = lambda msg: msg
    20 _ = lambda msg: msg
    21 
    21 
    44                     if newval and newval != val:
    44                     if newval and newval != val:
    45                         try:
    45                         try:
    46                             LazyConfig.set(self, '%s.%s' % (section, opt),
    46                             LazyConfig.set(self, '%s.%s' % (section, opt),
    47                                            newval)
    47                                            newval)
    48                             break
    48                             break
    49                         except (ValueError, ConfigValueError), err:
    49                         except (ValueError, ConfigValueError, VMMError), err:
    50                             w_err(0, _(u'Warning: %s') % err)
    50                             w_err(0, _(u'Warning: %s') % err)
    51                             failures += 1
    51                             failures += 1
    52                             if failures > 2:
    52                             if failures > 2:
    53                                 raise ConfigError(_(u'Too many failures - try '
    53                                 raise ConfigError(_(u'Too many failures - try '
    54                                                     u'again later.'),
    54                                                     u'again later.'),