def _parse_args(self):
        self._arg_parser.add_argument('--config',
                                      '-c',
                                      action='append',
                                      help=_('Path of configuration file'))

        self._args = self._arg_parser.parse_args(self._sys_argv)
Exemple #2
0
    def _try_connect(self):
        try:
            self._conn = Connection(*self._conn_args[0], **self._conn_args[1])
        except ConnectionFailure:
            self._conn = None

            _logger.exception(_('Failed to connect to database server'))

            return False
        else:
            return True
    def _try_connect(self):
        try:
            self._conn = Connection(*self._conn_args[0], **self._conn_args[1])
        except ConnectionFailure:
            self._conn = None

            _logger.exception(_('Failed to connect to database server'))

            return False
        else:
            return True
    def __init__(self, arg_parser=None, config_parser=None, argv=None):
        '''Helps to gather settings needed for applications.'''
        super()

        self._sys_argv = argv if argv is not None else sys.argv[1:]
        self._arg_parser = arg_parser or argparse.ArgumentParser(
            description=_('Web application with no defined description'))
        self._config_parser = config_parser or configparser.ConfigParser()

        self._parse_args()
        self._load_config()
Exemple #5
0
    def __init__(self, arg_parser=None, config_parser=None, argv=None):
        '''Helps to gather settings needed for applications.'''
        super()

        self._sys_argv = argv if argv is not None else sys.argv[1:]
        self._arg_parser = arg_parser or argparse.ArgumentParser(
            description=_('Web application with no defined description'))
        self._config_parser = config_parser or configparser.ConfigParser()

        self._parse_args()
        self._load_config()
Exemple #6
0
    def _parse_args(self):
        self._arg_parser.add_argument('--config', '-c', action='append',
            help=_('Path of configuration file'))

        self._args = self._arg_parser.parse_args(self._sys_argv)