routes/admin.py: DetailedHistory: backward-compatibility

See https://github.com/ngoduykhanh/PowerDNS-Admin/pull/1066
This commit is contained in:
zoeller-freinet 2021-12-04 17:38:48 +01:00
parent f0008ce401
commit 737e1fb93b

View File

@ -844,7 +844,7 @@ class DetailedHistory():
keyname=DetailedHistory.get_key_val(detail_dict, "key"),
rolename=DetailedHistory.get_key_val(detail_dict, "role"),
description=DetailedHistory.get_key_val(detail_dict, "description"),
linked_domains=DetailedHistory.get_key_val(detail_dict, "domains"),
linked_domains=DetailedHistory.get_key_val(detail_dict, "domains" if "domains" in detail_dict else "domain_acl"),
linked_accounts=DetailedHistory.get_key_val(detail_dict, "accounts"))
elif 'Delete API key' in history.msg:
@ -886,7 +886,7 @@ class DetailedHistory():
# check for lower key as well for old databases
@staticmethod
def get_key_val(_dict, key):
return _dict.get(key, _dict.get(key.lower(), ''))
return str(_dict.get(key, _dict.get(key.title(), '')))
# convert a list of History objects into DetailedHistory objects