Ejemplo n.º 1
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)
Ejemplo n.º 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
Ejemplo n.º 3
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
Ejemplo n.º 4
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()
Ejemplo n.º 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()
Ejemplo n.º 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)