properly load and reinitialize contents cache

This commit is contained in:
InspectorCaracal 2024-10-19 16:30:13 -06:00 committed by GitHub
parent 7395d7091d
commit 7f8619d2c7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -60,7 +60,7 @@ class ContentsHandler:
Returns: Returns:
Objects (list of ObjectDB) Objects (list of ObjectDB)
""" """
return list(self.obj.locations_set.all()) return list(obj for obj in self.obj.locations_set.all() if obj.pk)
def init(self): def init(self):
""" """
@ -68,6 +68,7 @@ class ContentsHandler:
""" """
objects = self.load() objects = self.load()
self._typecache = defaultdict(dict)
self._pkcache = {obj.pk: True for obj in objects} self._pkcache = {obj.pk: True for obj in objects}
for obj in objects: for obj in objects:
try: try: