From d17a79c12886ebb8af89195fcec67ab945870686 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Thu, 10 Mar 2022 11:24:52 -0800 Subject: [PATCH] Store into cache using instance.id instead of requested id. This helps ensure that the keys of the cache are the true and correct data type and not just whatever the user provided. SQLite coerces strings and ints. --- voussoirkit/worms.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/voussoirkit/worms.py b/voussoirkit/worms.py index 0b90e6b..88b61f3 100644 --- a/voussoirkit/worms.py +++ b/voussoirkit/worms.py @@ -455,7 +455,7 @@ class DatabaseWithCaching(Database, metaclass=abc.ABCMeta): instance = object_class(self, object_row) if object_cache is not None: - object_cache[object_id] = instance + object_cache[instance.id] = instance return instance