VirtualMailManager/cli/Handler.py
branchv0.6.x
changeset 318 4dc2edf02d11
parent 316 31d8931dc535
child 319 f4956b4ceba1
equal deleted inserted replaced
317:d619e97a8f18 318:4dc2edf02d11
    40         # and add some command line checks.
    40         # and add some command line checks.
    41         skip_some_checks = os.sys.argv[1] in ('cf', 'configure', 'h', 'help',
    41         skip_some_checks = os.sys.argv[1] in ('cf', 'configure', 'h', 'help',
    42                                               'v', 'version')
    42                                               'v', 'version')
    43         super(CliHandler, self).__init__(skip_some_checks)
    43         super(CliHandler, self).__init__(skip_some_checks)
    44 
    44 
    45         self._Cfg = Cfg(self._cfgFileName)
    45         self._cfg = Cfg(self._cfg_fname)
    46         self._Cfg.load()
    46         self._cfg.load()
    47         if not skip_some_checks:
    47         if not skip_some_checks:
    48             self._Cfg.check()
    48             self._cfg.check()
    49             self._chkenv()
    49             self._chkenv()
    50 
    50 
    51     def cfgSet(self, option, value):
    51     def cfgSet(self, option, value):
    52         return self._Cfg.set(option, value)
    52         return self._cfg.set(option, value)
    53 
    53 
    54     def configure(self, section=None):
    54     def configure(self, section=None):
    55         """Starts the interactive configuration.
    55         """Starts the interactive configuration.
    56 
    56 
    57         Configures in interactive mode options in the given ``section``.
    57         Configures in interactive mode options in the given ``section``.
    58         If no section is given (default) all options from all sections
    58         If no section is given (default) all options from all sections
    59         will be prompted.
    59         will be prompted.
    60         """
    60         """
    61         if section is None:
    61         if section is None:
    62             self._Cfg.configure(self._Cfg.sections())
    62             self._cfg.configure(self._cfg.sections())
    63         elif self._Cfg.has_section(section):
    63         elif self._cfg.has_section(section):
    64             self._Cfg.configure([section])
    64             self._cfg.configure([section])
    65         else:
    65         else:
    66             raise VMMError(_(u'Invalid section: ā€œ%sā€') % section,
    66             raise VMMError(_(u'Invalid section: ā€œ%sā€') % section,
    67                            INVALID_SECTION)
    67                            INVALID_SECTION)
    68 
    68 
    69     def user_add(self, emailaddress, password=None):
    69     def user_add(self, emailaddress, password=None):