]> git.ipfire.org Git - ipfire.org.git/commitdiff
webapp: Remove lazy initialization of backend
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 25 Apr 2018 11:42:56 +0000 (13:42 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 25 Apr 2018 11:42:56 +0000 (13:42 +0200)
This is no longer required in single-threaded mode

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
webapp.py
webapp/__init__.py

index 10318dcc42b60c327bdd34adbe49100e4228dc55..711aa2377e1a762ced5b85ddc49f2d3aab2c8e59 100755 (executable)
--- 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
index d4bcb5cf51d43addc3d7de90ba09c4270e6d54ea..52a3bff2df8bc473079f80968298470a0bf7d18d 100644 (file)
@@ -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