From 3e7c6ccdef6e5b63f9b015766cfb894931b43e65 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Wed, 25 Apr 2018 13:42:56 +0200 Subject: [PATCH] webapp: Remove lazy initialization of backend This is no longer required in single-threaded mode Signed-off-by: Michael Tremer --- webapp.py | 2 +- webapp/__init__.py | 17 +++-------------- 2 files changed, 4 insertions(+), 15 deletions(-) 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 -- 2.39.5