From a99045544b1a18e564aee1adb7b0ac60f591e05c Mon Sep 17 00:00:00 2001 From: jrcastro2 Date: Fri, 8 Nov 2024 16:35:32 +0100 Subject: [PATCH] uow: improve decorator to create uow if it's None * closes https://github.com/CERNDocumentServer/cds-rdm/issues/193 --- invenio_db/uow.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/invenio_db/uow.py b/invenio_db/uow.py index 73ec442..4b80fd4 100644 --- a/invenio_db/uow.py +++ b/invenio_db/uow.py @@ -242,7 +242,7 @@ def aservice_method(self, ...., uow=None): def decorator(f): @wraps(f) def inner(self, *args, **kwargs): - if "uow" not in kwargs: + if "uow" not in kwargs or kwargs["uow"] is None: # Migration path - start a UoW and commit with UnitOfWork(db.session) as uow: kwargs["uow"] = uow