diff --git a/debug_toolbar/toolbar.py b/debug_toolbar/toolbar.py index c1f35b02c..85757d3e9 100644 --- a/debug_toolbar/toolbar.py +++ b/debug_toolbar/toolbar.py @@ -92,15 +92,9 @@ def store(self): if self.store_id: return self.store_id = uuid.uuid4().hex - cls = type(self) - cls._store[self.store_id] = self - for _ in range(len(cls._store) - self.config["RESULTS_CACHE_SIZE"]): - try: - # collections.OrderedDict - cls._store.popitem(last=False) - except TypeError: - # django.utils.datastructures.SortedDict - del cls._store[cls._store.keyOrder[0]] + self._store[self.store_id] = self + for _ in range(self.config["RESULTS_CACHE_SIZE"], len(self._store)): + self._store.popitem(last=False) @classmethod def fetch(cls, store_id):