From d87b757ce0f21493d26b5ef18e4589db0d3f3764 Mon Sep 17 00:00:00 2001 From: Maximilian Moser Date: Thu, 2 May 2024 15:32:22 +0200 Subject: [PATCH] versions: dump UUIDs as string * dump the UUIDs for `latest_id` and `next_draft_id` as string, if they are not `None` * otherwise, the results may not be manageable for further processing (e.g. `json.dumps(...)`) --- invenio_drafts_resources/records/systemfields/versions.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/invenio_drafts_resources/records/systemfields/versions.py b/invenio_drafts_resources/records/systemfields/versions.py index d0b9f83..3fb1adf 100644 --- a/invenio_drafts_resources/records/systemfields/versions.py +++ b/invenio_drafts_resources/records/systemfields/versions.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # # Copyright (C) 2021-2023 CERN. +# Copyright (C) 2024 TU Wien. # # Invenio-Drafts-Resources is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see LICENSE file for more @@ -148,9 +149,9 @@ def set_latest(self): def dump(self): """Dump the versions state to the index.""" return dict( - latest_id=self.latest_id, + latest_id=str(self.latest_id) if self.latest_id else None, latest_index=self.latest_index, - next_draft_id=self.next_draft_id, + next_draft_id=str(self.next_draft_id) if self.next_draft_id else None, is_latest=self.is_latest, is_latest_draft=self.is_latest_draft, index=self.index,