def __init__(self, handler, plugins=(), **kwargs): Thread.__init__(self, name='ServerMain') from calibre.srv.opts import Options from calibre.srv.loop import ServerLoop from calibre.srv.http_response import create_http_handler self.setup_defaults(kwargs) self.loop = ServerLoop( create_http_handler(handler), opts=Options(**kwargs), plugins=plugins, log=ServerLog(level=ServerLog.DEBUG), ) self.log = self.loop.log
def __init__(self, handler, plugins=(), specialize=lambda srv:None, **kwargs): Thread.__init__(self, name='ServerMain') from calibre.srv.opts import Options from calibre.srv.loop import ServerLoop from calibre.srv.http_response import create_http_handler self.setup_defaults(kwargs) self.loop = ServerLoop( create_http_handler(handler), opts=Options(**kwargs), plugins=plugins, log=ServerLog(level=ServerLog.WARN), ) self.log = self.loop.log self.silence_log = self.log specialize(self)
def __init__(self, handler, plugins=(), specialize=lambda srv:None, **kwargs): Thread.__init__(self, name='ServerMain') from calibre.srv.opts import Options from calibre.srv.loop import ServerLoop from calibre.srv.http_response import create_http_handler kwargs['shutdown_timeout'] = kwargs.get('shutdown_timeout', 0.1) kwargs['listen_on'] = kwargs.get('listen_on', 'localhost') kwargs['port'] = kwargs.get('port', 0) self.loop = ServerLoop( create_http_handler(handler), opts=Options(**kwargs), plugins=plugins, log=ServerLog(level=ServerLog.WARN), ) self.log = self.loop.log specialize(self)
def __init__(self, library_path, libraries=(), plugins=(), **kwargs): Thread.__init__(self, name='ServerMain') from calibre.srv.opts import Options from calibre.srv.loop import ServerLoop from calibre.srv.handler import Handler from calibre.srv.http_response import create_http_handler self.setup_defaults(kwargs) opts = Options(**kwargs) self.libraries = libraries or (library_path, ) self.handler = Handler(self.libraries, opts, testing=True) self.loop = ServerLoop( create_http_handler(self.handler.dispatch), opts=opts, plugins=plugins, log=ServerLog(level=ServerLog.DEBUG), ) self.log = self.loop.log self.handler.set_log(self.log)