From: Michael Tremer Date: Sun, 12 Jan 2025 13:34:59 +0000 (+0000) Subject: web: Set globals to avoid a namespace that is too large X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9b3b117fc6b02c4fc93218c8eb64e1f1b136d0c1;p=pbs.git web: Set globals to avoid a namespace that is too large Signed-off-by: Michael Tremer --- diff --git a/src/web/base.py b/src/web/base.py index f8f23189..9473d13a 100644 --- a/src/web/base.py +++ b/src/web/base.py @@ -231,17 +231,21 @@ class BaseHandler(tornado.web.RequestHandler): cache_size = -1, ) + # Configure global variables + env.globals |= { + "backend" : self.backend, + "version" : __version__, + } + return JinjaTemplateLoader(env) def get_template_namespace(self): ns = tornado.web.RequestHandler.get_template_namespace(self) ns.update({ - "backend" : self.backend, "hostname" : self.request.host, "format_date" : self.format_date, "format_size" : misc.format_size, - "version" : __version__, "xsrf_token" : self.xsrf_token, "year" : time.strftime("%Y"), })