diff --git a/matemat/webserver/pagelets/signup.py b/matemat/webserver/pagelets/signup.py index 99f19e0..d1bb453 100644 --- a/matemat/webserver/pagelets/signup.py +++ b/matemat/webserver/pagelets/signup.py @@ -70,7 +70,8 @@ def signup(): elif request.method != 'GET': abort(405, 'Method not allowed') - acl = netaddr.IPSet([addr.strip() for addr in config.get('SignupKioskMode', '').split(',')]) + acl_addrs = [s.strip() for s in config.get('SignupKioskMode', '').split(',') if s.strip()] + acl = netaddr.IPSet(acl_addrs) if request.remote_addr in acl: return template.render('signup_kiosk.html', signup=(config.get('SignupEnabled', '0') == '1'), diff --git a/matemat/webserver/template/template.py b/matemat/webserver/template/template.py index f9bbf4b..ba116f4 100644 --- a/matemat/webserver/template/template.py +++ b/matemat/webserver/template/template.py @@ -29,7 +29,8 @@ def render(name: str, **kwargs): global __jinja_env config = get_app_config() template: jinja2.Template = __jinja_env.get_template(name) - wsacl = netaddr.IPSet([addr.strip() for addr in config.get('BarcodeWebsocketAcl', '').split(',')]) + wsacl_addrs = [s.strip() for s in config.get('BarcodeWebsocketAcl', '').split(',') if s.strip()] + wsacl = netaddr.IPSet(wsacl_addrs) if config.get('BarcodeWebsocketUrl', '') and hasattr(request, 'remote_addr') and request.remote_addr in wsacl: bcwebsocket = config.get('BarcodeWebsocketUrl') else: