From bb0424f9e1f41e7000f3b75a43762665801ab841 Mon Sep 17 00:00:00 2001 From: Mirek Simek Date: Mon, 17 Feb 2025 14:38:22 +0100 Subject: [PATCH] Access status hotfix (#257) * Access status hotfix * Access status hotfix * Removed double serialization of tombstone --- oarepo_runtime/services/schema/ui.py | 9 +++++++++ setup.cfg | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/oarepo_runtime/services/schema/ui.py b/oarepo_runtime/services/schema/ui.py index 7df8567..4452030 100644 --- a/oarepo_runtime/services/schema/ui.py +++ b/oarepo_runtime/services/schema/ui.py @@ -180,3 +180,12 @@ def _serialize(self, value, attr, obj, **kwargs): class InvenioRDMUISchema(InvenioUISchema, RDMBaseRecordSchema): is_draft = ma.fields.Boolean(dump_only=True) + access_status = AccessStatusField(attribute="access", dump_only=True) + + def hide_tombstone(self, data): + """Hide tombstone info if the record isn't deleted and metadata if it is.""" + return data + + def default_nested(self, data): + """Serialize fields as empty dict for partial drafts.""" + return data diff --git a/setup.cfg b/setup.cfg index 966d2dd..fcb6626 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = oarepo-runtime -version = 1.5.94 +version = 1.5.95 description = A set of runtime extensions of Invenio repository authors = Alzbeta Pokorna readme = README.md