database: fix type reported in overwrite warning

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan 2022-02-16 09:13:45 -05:00
parent c1104617b6
commit 89e78b9a00
1 changed files with 3 additions and 2 deletions

View File

@ -203,10 +203,11 @@ class MoonrakerDatabase:
if len(key_list) > 1: if len(key_list) > 1:
record = self._get_record(namespace, key_list[0], force=True) record = self._get_record(namespace, key_list[0], force=True)
if not isinstance(record, dict): if not isinstance(record, dict):
prev_type = type(record)
record = {} record = {}
logging.info( logging.info(
f"Warning: Key {key_list[0]} contains a value of type" f"Warning: Key {key_list[0]} contains a value of type "
f" {type(record)}. Overwriting with an object.") f"{prev_type}. Overwriting with an object.")
item: Dict[str, Any] = reduce( item: Dict[str, Any] = reduce(
getitem_with_default, key_list[1:-1], record) getitem_with_default, key_list[1:-1], record)
item[key_list[-1]] = value item[key_list[-1]] = value