From e23ba65c718bb403a4a6b10bd1d844c3ded98747 Mon Sep 17 00:00:00 2001 From: s3lph Date: Wed, 11 Dec 2024 00:12:33 +0100 Subject: [PATCH] fix: non-http templates --- matemat/webserver/template/template.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/matemat/webserver/template/template.py b/matemat/webserver/template/template.py index e42555f..f9bbf4b 100644 --- a/matemat/webserver/template/template.py +++ b/matemat/webserver/template/template.py @@ -30,7 +30,7 @@ def render(name: str, **kwargs): config = get_app_config() template: jinja2.Template = __jinja_env.get_template(name) wsacl = netaddr.IPSet([addr.strip() for addr in config.get('BarcodeWebsocketAcl', '').split(',')]) - if config.get('BarcodeWebsocketUrl', '') and request.remote_addr in wsacl: + if config.get('BarcodeWebsocketUrl', '') and hasattr(request, 'remote_addr') and request.remote_addr in wsacl: bcwebsocket = config.get('BarcodeWebsocketUrl') else: bcwebsocket = None