From: Michael Tremer Date: Sat, 7 Oct 2017 11:59:16 +0000 (+0100) Subject: Rename self.pakfire to self.backend in web and hub X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4b9167efb4f949f04a5b8d2a157f9cd7a4cdaad5;p=pbs.git Rename self.pakfire to self.backend in web and hub Signed-off-by: Michael Tremer --- diff --git a/src/hub/handlers.py b/src/hub/handlers.py index e98b1b30..1aad2a05 100644 --- a/src/hub/handlers.py +++ b/src/hub/handlers.py @@ -36,9 +36,9 @@ class BaseHandler(LongPollMixin, tornado.web.RequestHandler): @property def backend(self): """ - Shortcut handler to pakfire instance. + Shortcut handler to pakfire instance """ - return self.application.pakfire + return self.application.backend def get_basic_auth_credentials(self): """ diff --git a/src/web/__init__.py b/src/web/__init__.py index 194d5ced..0abd0d96 100644 --- a/src/web/__init__.py +++ b/src/web/__init__.py @@ -10,6 +10,7 @@ import tornado.options import tornado.web from .. import Backend +from ..decorators import * from . import handlers_api @@ -22,8 +23,6 @@ tornado.options.parse_command_line() class Application(tornado.web.Application): def __init__(self): - self.__pakfire = None - settings = dict( debug = tornado.options.options.debug, gzip = True, @@ -244,12 +243,12 @@ class Application(tornado.web.Application): logging.info("Successfully initialied application") - @property - def pakfire(self): - if self.__pakfire is None: - self.__pakfire = Backend() - - return self.__pakfire + @lazy_property + def backend(self): + """ + Backend connection + """ + return Backend() def __del__(self): logging.info("Shutting down application") diff --git a/src/web/handlers_base.py b/src/web/handlers_base.py index 19d5c2a5..ee79e184 100644 --- a/src/web/handlers_base.py +++ b/src/web/handlers_base.py @@ -112,7 +112,7 @@ class BaseHandler(tornado.web.RequestHandler): @property def pakfire(self): - return self.application.pakfire + return self.application.backend @property def arches(self): diff --git a/src/web/ui_modules.py b/src/web/ui_modules.py index 4bdb0eec..7279c3c0 100644 --- a/src/web/ui_modules.py +++ b/src/web/ui_modules.py @@ -17,7 +17,7 @@ from ..constants import * class UIModule(tornado.web.UIModule): @property def pakfire(self): - return self.handler.application.pakfire + return self.handler.application.backend @property def settings(self):