aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--debug_toolbar/toolbar.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/debug_toolbar/toolbar.py b/debug_toolbar/toolbar.py
index ec840dd..53b3182 100644
--- a/debug_toolbar/toolbar.py
+++ b/debug_toolbar/toolbar.py
@@ -89,9 +89,12 @@ class DebugToolbar(object):
cls = type(self)
cls._store[self.store_id] = self
for _ in range(len(cls._store) - self.config['RESULTS_STORE_SIZE']):
- # When we drop support for Python 2.6 and switch to
- # collections.OrderedDict, use popitem(last=False).
- del cls._store[cls._store.keyOrder[0]]
+ try:
+ # collections.OrderedDict
+ cls._store.popitem(last=False)
+ except TypeError:
+ # django.utils.datastructures.SortedDict
+ del cls._store[cls._store.keyOrder[0]]
@classmethod
def fetch(cls, store_id):