Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
@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):
"""
import tornado.web
from .. import Backend
+from ..decorators import *
from . import handlers_api
class Application(tornado.web.Application):
def __init__(self):
- self.__pakfire = None
-
settings = dict(
debug = tornado.options.options.debug,
gzip = True,
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")
@property
def pakfire(self):
- return self.application.pakfire
+ return self.application.backend
@property
def arches(self):
class UIModule(tornado.web.UIModule):
@property
def pakfire(self):
- return self.handler.application.pakfire
+ return self.handler.application.backend
@property
def settings(self):