Skip to content

Commit

Permalink
fix asset display when asset has no owner (#514)
Browse files Browse the repository at this point in the history
* fix asset display when asset has no owner

Signed-off-by: Nicolas Höning <nicolas@seita.nl>

* more modern typing of Optional

Signed-off-by: Nicolas Höning <nicolas@seita.nl>

Signed-off-by: Nicolas Höning <nicolas@seita.nl>
  • Loading branch information
nhoening committed Oct 13, 2022
1 parent 6b9d882 commit 35ede27
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions flexmeasures/data/services/sensors.py
Expand Up @@ -7,7 +7,7 @@


def get_sensors(
account: Account | list[Account],
account: Account | list[Account] | None,
include_public_assets: bool = False,
sensor_id_allowlist: list[int] | None = None,
sensor_name_allowlist: list[str] | None = None,
Expand All @@ -20,7 +20,9 @@ def get_sensors(
:param sensor_name_allowlist: optionally, allow only sensors whose name is in this list
"""
sensor_query = Sensor.query
if isinstance(account, list):
if account is None:
account_ids = []
elif isinstance(account, list):
account_ids = [account.id for account in account]
else:
account_ids = [account.id]
Expand Down

0 comments on commit 35ede27

Please sign in to comment.