diff --git a/CHANGES.rst b/CHANGES.rst index 3dac82c..a54bd00 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -5,7 +5,8 @@ Changelog 1.3.1 (unreleased) ------------------ -- Nothing changed yet. +- Handle missing record in restapi endpoint. + [cekk] 1.3.0 (2024-03-07) diff --git a/src/redturtle/voltoplugin/editablefooter/restapi/get.py b/src/redturtle/voltoplugin/editablefooter/restapi/get.py index c34ec08..5ed110b 100644 --- a/src/redturtle/voltoplugin/editablefooter/restapi/get.py +++ b/src/redturtle/voltoplugin/editablefooter/restapi/get.py @@ -23,12 +23,15 @@ class EditableFooterGet(Service): def reply(self): res = {"footer_top": None, "footer_columns": None} - footer_top = api.portal.get_registry_record( - "footer_top", interface=IEditableFooterSettings, default="" - ) footer_columns = api.portal.get_registry_record( "footer_columns", interface=IEditableFooterSettings, default="" ) + try: + footer_top = api.portal.get_registry_record( + "footer_top", interface=IEditableFooterSettings, default="" + ) + except KeyError: + footer_top = "" if footer_top: res["footer_top"] = json.loads(footer_top) if not footer_columns: