示例#1
0
 def __load_example(self):
     self.__config['example'] = ConfigCommon()
     self['example']['path'] = self['app']['example_config_user']
     try:
         self['example']['content'] = open(self['app']['example_config_user']).read()
     except Exception as e:
         _logger.warn('Open user config example failed: %s' % e)
         self['example']['content'] = ''
示例#2
0
 def reset(self, config_entry=None):
     if config_entry is None and 'entry' in self:
         config_entry = self['entry']
     self.__config = {}
     self.__config['entry'] = ConfigCommon()
     for k, v in config_entry.items():
         if v is not None:
             self['entry'][k] = v
示例#3
0
 def __load_option_list(self):
     self.__config['option_list'] = ConfigCommon()
     if 'handler_python_dir' not in self['release_path']:
         return
     try:
         with Handler(self['release_path']['handler_python_dir']) as h:
             self['option_list'].update(h.run('option'))
     except HandlerNotFoundError:
         _logger.debug('Handler for option not found')
示例#4
0
    def __load_user(self):
        self.__config['user'] = ConfigCommon()

        config_user_file = self['app']['config_user_file']
        if 'config_user_file' in self['entry']:
            config_user_file = self['entry']['config_user_file']
        self['user'].load_from_file(expand_path(config_user_file))

        if 'config_user' in self['entry']:
            self['user'] = copy.deepcopy(self['entry']['config_user'])
示例#5
0
    def __load_output(self):
        self.__config['output'] = ConfigCommon()

        # verbose
        self['output']['verbose'] = False
        if 'verbose' in self['user']:
            self['output']['verbose'] = self['user']['verbose']
        if 'verbose' in self['entry']:
            self['output']['verbose'] = self['entry']['verbose']

        # quiet
        self['output']['quiet'] = False
        if 'quiet' in self['user']:
            self['output']['quiet'] = self['user']['quiet']
        if 'quiet' in self['entry']:
            self['output']['quiet'] = self['entry']['quiet']
示例#6
0
 def __load_release_status(self):
     self.__config['release_status'] = ConfigCommon()
     self['release_status'].load_from_file(self['release_path']['status_file'])
示例#7
0
 def __load_info(self):
     self.__config['info'] = ConfigCommon()
     self['info'].load_from_file(expand_path(self['app']['config_info_file']))