mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-07 21:51:14 -07:00
parent
2a48e3375a
commit
d9b3b311b9
1 changed files with 10 additions and 6 deletions
|
@ -119,11 +119,15 @@ else:
|
||||||
from plexpy import macos
|
from plexpy import macos
|
||||||
|
|
||||||
|
|
||||||
def serve_template(templatename, **kwargs):
|
TEMPLATE_LOOKUP = None
|
||||||
|
|
||||||
|
|
||||||
|
def serve_template(template_name, **kwargs):
|
||||||
|
global TEMPLATE_LOOKUP
|
||||||
|
if TEMPLATE_LOOKUP is None:
|
||||||
interface_dir = os.path.join(str(plexpy.PROG_DIR), 'data/interfaces/')
|
interface_dir = os.path.join(str(plexpy.PROG_DIR), 'data/interfaces/')
|
||||||
template_dir = os.path.join(str(interface_dir), plexpy.CONFIG.INTERFACE)
|
template_dir = os.path.join(str(interface_dir), plexpy.CONFIG.INTERFACE)
|
||||||
|
TEMPLATE_LOOKUP = TemplateLookup(directories=[template_dir], default_filters=['unicode', 'h'],
|
||||||
_hplookup = TemplateLookup(directories=[template_dir], default_filters=['unicode', 'h'],
|
|
||||||
error_handler=mako_error_handler)
|
error_handler=mako_error_handler)
|
||||||
|
|
||||||
http_root = plexpy.HTTP_ROOT
|
http_root = plexpy.HTTP_ROOT
|
||||||
|
@ -133,7 +137,7 @@ def serve_template(templatename, **kwargs):
|
||||||
_session = get_session_info()
|
_session = get_session_info()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
template = _hplookup.get_template(templatename)
|
template = TEMPLATE_LOOKUP.get_template(template_name)
|
||||||
return template.render(http_root=http_root, server_name=server_name, cache_param=cache_param,
|
return template.render(http_root=http_root, server_name=server_name, cache_param=cache_param,
|
||||||
_session=_session, **kwargs)
|
_session=_session, **kwargs)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue