From 6a43b3f15ca9cc2eab1a13f6670921f71809a956 Mon Sep 17 00:00:00 2001 From: Sebastiaan Huber Date: Fri, 7 Jul 2023 16:57:27 -0500 Subject: [PATCH] `SqliteZipBackend`: Return `self` in `store` The `store` method of the `SqliteEntityOverride` class, used by the `SqliteZipBackend` storage backend (and with that all other backends to subclass this), did not return `self`. This is in conflict with the signature of the base class that it is overriding. Since the `SqliteZipBackend` is read-only and so `store` would never be called, this problem went unnoticed. However, with the addition of the `SqliteDosStorage` backend which is *not* read-only, this bug would surface when trying to store a node since certain methods rely on this method returning the node instance itself. --- aiida/storage/sqlite_zip/orm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aiida/storage/sqlite_zip/orm.py b/aiida/storage/sqlite_zip/orm.py index eaa1dab875..023421875e 100644 --- a/aiida/storage/sqlite_zip/orm.py +++ b/aiida/storage/sqlite_zip/orm.py @@ -70,7 +70,7 @@ def store(self, *args, **kwargs): backend = self._model._backend # pylint: disable=protected-access if getattr(backend, '_read_only', False): raise ReadOnlyError(f'Cannot store entity in read-only backend: {backend}') - super().store(*args, **kwargs) # type: ignore # pylint: disable=no-member + return super().store(*args, **kwargs) # type: ignore # pylint: disable=no-member class SqliteUser(SqliteEntityOverride, users.SqlaUser):