Skip to content

Commit

Permalink
BUG: flatten cache entry in FilestoreBackend.save_entry
Browse files Browse the repository at this point in the history
.save_entry didn't flatten the new entry when inserting it into the
backend cache, and the cache is reconstructed from _root in every
_load_or_initialize call.  This means once the filestore_backend
fixture is set up, the final entry's children aren't accessible from
the cache until _load_or_initialize is called.

Flattening new entries in .save_entry fixes this issue.
  • Loading branch information
shilorigins committed Nov 25, 2024
1 parent b2d4466 commit 7a3a1f9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion superscore/backends/filestore.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ def save_entry(self, entry: Entry) -> None:
if db.get(entry.uuid):
raise BackendError("Entry already exists, try updating the entry "
"instead of saving it")
db[entry.uuid] = entry
self.flatten_and_cache(entry)
self._root.entries.append(entry)

def update_entry(self, entry: Entry) -> None:
Expand Down

0 comments on commit 7a3a1f9

Please sign in to comment.