From 0fec1bfea8d6d9a6f473552e07918f08ba61f0e8 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