From: Michael Tremer Date: Wed, 25 Apr 2018 11:42:56 +0000 (+0200) Subject: webapp: Remove lazy initialization of backend X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3e7c6ccdef6e5b63f9b01576;p=ipfire.org.git webapp: Remove lazy initialization of backend This is no longer required in single-threaded mode Signed-off-by: Michael Tremer --- diff --git a/webapp.py b/webapp.py index 10318dcc..711aa237 100755 --- a/webapp.py +++ b/webapp.py @@ -11,7 +11,7 @@ def run(): tornado.options.parse_command_line() # Initialize application - app = Application(configfile="webapp.conf") + app = Application("webapp.conf") app.listen(tornado.options.options.port) # Launch IOLoop diff --git a/webapp/__init__.py b/webapp/__init__.py index d4bcb5cf..52a3bff2 100644 --- a/webapp/__init__.py +++ b/webapp/__init__.py @@ -14,8 +14,9 @@ from ui_modules import * BASEDIR = os.path.join(os.path.dirname(__file__), "..") class Application(tornado.web.Application): - def __init__(self, **kwargs): - self.__backend = None + def __init__(self, config, **kwargs): + # Initialize backend + self.backend = backend.Backend(config) settings = dict( debug = tornado.options.options.debug, @@ -270,18 +271,6 @@ class Application(tornado.web.Application): logging.info("Successfully initialied application") - @property - def backend(self): - if self.__backend is None: - configfile = self.settings.get("configfile", None) - if not configfile: - raise RuntimeException("Could not find configuration file") - - self.__backend = backend.Backend(configfile=configfile, - debug=self.settings.get("debug", False)) - - return self.__backend - def format_month_name(self, handler, month): _ = handler.locale.translate