Пример #1
0
def factor_database_connection_pool():
    creator = ConnectionCreator()
    pool_size = config.getint('database', 'pool_size')
    max_overflow = config.getint('database', 'max_overflow')

    return FreshConnectionQueuePool(creator,
                                    pool_size=pool_size,
                                    max_overflow=max_overflow)
Пример #2
0
 def __init__(self):
     self._host = config.get('telnet', 'host')
     self._port = config.getint('telnet', 'port')
     self._locals = None
     self._logger = get_logger()
     self._telnet_server = TelnetInteractiveConsoleServer(
         self._host, self._port, self._locals)
Пример #3
0
    def __init__(self, shutdown_event):
        host = config.get('http', 'host')
        port = config.getint('http', 'port')

        self._set_address_family(host)
        HTTPServer.__init__(self, (host, port), YuRequestHandler)

        if config.has_option('http', 'hostname'):
            hostname = config.get('http', 'hostname')
            if port != 80:
                hostname = '%s:%s' % (hostname, port)
        else:
            # TODO we could get the hostname from the IP the server is
            # bound to if we want this, for now we use a stupid fallback
            hostname = 'yaturl.net'

        # store important information here to be able to access it in the request handler
        self.hostname = hostname
        self.resolve_clients = config.getboolean('http', 'resolve_clients')
        self.log_ip_activated = config.getboolean('main', 'log_ip_activated')
        self._shutdown = shutdown_event
        self._logger = get_logger()
Пример #4
0
    def __init__(self, shutdown_event):
        host = config.get('http', 'host')
        port = config.getint('http', 'port')

        self._set_address_family(host)
        HTTPServer.__init__(self, (host, port), YuRequestHandler)

        if config.has_option('http', 'hostname'):
            hostname = config.get('http', 'hostname')
            if port != 80:
                hostname = '%s:%s' % (hostname, port)
        else:
            # TODO we could get the hostname from the IP the server is
            # bound to if we want this, for now we use a stupid fallback
            hostname = 'yaturl.net'

        # store important information here to be able to access it in the request handler
        self.hostname = hostname
        self.resolve_clients = config.getboolean('http', 'resolve_clients')
        self.log_ip_activated = config.getboolean('main', 'log_ip_activated')
        self._shutdown = shutdown_event
        self._logger = get_logger()
Пример #5
0
    def _set_min_url_lenth(self):
        if config.has_option('main', 'min_url_length'):
            self._min_url_length = config.getint('main', 'min_url_length')

        if not self._min_url_length or self._min_url_length < 1:
            self._min_url_length = 4
Пример #6
0
 def __init__(self):
     self._host = config.get("telnet", "host")
     self._port = config.getint("telnet", "port")
     self._locals = None
     self._logger = get_logger()
     self._telnet_server = TelnetInteractiveConsoleServer(self._host, self._port, self._locals)
Пример #7
0
 def __init__(self):
     self._user = config.get('database', 'user')
     self._passwd = config.get('database', 'password')
     self._hostname = config.get('database', 'host')
     self._port = config.getint('database', 'port')
     self._database = config.get('database', 'database')