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