Przeglądaj źródła

tolerate missing name in ServiceConfig

Fall back to the service key when name is absent from a data-home
config override, preventing a KeyError crash on startup.
ZiB 4 miesięcy temu
rodzic
commit
354c9d0647
1 zmienionych plików z 1 dodań i 1 usunięć
  1. 1 1
      room_cal/_utils.py

+ 1 - 1
room_cal/_utils.py

@@ -166,7 +166,7 @@ class ServiceConfig:
   def from_dict(cls, key: str, d: dict) -> 'ServiceConfig':
   def from_dict(cls, key: str, d: dict) -> 'ServiceConfig':
     return cls(
     return cls(
       key=key,
       key=key,
-      name=d['name'],
+      name=d.get('name', key),
       room_id=str(d.get('room_id', '')),
       room_id=str(d.get('room_id', '')),
       account_id=str(d.get('account_id', '')),
       account_id=str(d.get('account_id', '')),
       hotel_id=str(d.get('hotel_id', '')),
       hotel_id=str(d.get('hotel_id', '')),