Skip to content

Commit

Permalink
SqliteZipBackend: Return self in store
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sphuber committed Nov 16, 2023
1 parent 702f887 commit 6a43b3f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion aiida/storage/sqlite_zip/orm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 6a43b3f

Please sign in to comment.