Skip to content
Snippets Groups Projects
Commit 53cfbd8e authored by David Hammer's avatar David Hammer
Browse files

Handle warn_type None (constants use it)

parent 69a7ea0a
No related branches found
No related tags found
1 merge request!23Check timeserver per train
......@@ -47,7 +47,10 @@ class ContextWarningLamp:
if (warn_type not in self._active_warnings) or (
not only_print_once and message != self._active_warnings[warn_type]
):
self._device.log_status_warn(f"{warn_type.name}: {message}")
if warn_type is None:
self._device.log_status_warn(message)
else:
self._device.log_status_warn(f"{warn_type.name}: {message}")
self._new_warnings.add(warn_type)
self._active_warnings[warn_type] = message
......@@ -56,7 +59,9 @@ class ContextWarningLamp:
self._new_tested - self._new_warnings
):
del self._active_warnings[warn_type_lifted]
self._device.log_status_info(f"Lifted warning: {warn_type_lifted.name}")
# None is used for "simpler" lamps (like for constants)
if warn_type_lifted is not None:
self._device.log_status_info(f"Lifted warning: {warn_type_lifted.name}")
current_state = self._device.unsafe_get(self._schema_key)
if self._active_warnings and current_state != on_error:
self._device.set(self._schema_key, on_error)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment