diff --git a/generate.py b/generate.py index 9db6eba..a4a2a9d 100644 --- a/generate.py +++ b/generate.py @@ -109,7 +109,7 @@ def run_forever(address: str, period: int, ssid: str, output: str): if len(registered_leases) > 0: if len([lease for lease in registered_leases - if not any(re.match(ch, lease.hostname) for ch in config.computer_hostnames)]) > 0: + if not any(re.match(ch, lease.hostname or "") for ch in config.computer_hostnames)]) > 0: status = Status(status="populated", text="There seem to be people!") else: status = Status(status="empty", text="There are only computers.") @@ -139,7 +139,8 @@ def run_forever(address: str, period: int, ssid: str, output: str): writer.writerow((lease.ip, lease.mac, lease.hostname or "???")) elif output_file.endswith(".html"): last_human = next((lease for lease in _fetch_leases(db, now - timedelta(hours=24)) - if not any(re.match(ch, lease.hostname) for ch in config.computer_hostnames)), None) + if not any(re.match(ch, lease.hostname or "") for ch in config.computer_hostnames)), + None) logging.debug(f"Outputting HTML file into {output_file}...") with open(output_file, 'w') as file: diff --git a/templates/index.html b/templates/index.html index fcff62b..6161f2c 100644 --- a/templates/index.html +++ b/templates/index.html @@ -64,7 +64,7 @@ {% for lease in leases %}