From ba5af8f6fe7836eef0a0c85dd1e6d7418bc87f75 Mon Sep 17 00:00:00 2001 From: Aymeric Augustin Date: Sun, 15 Dec 2013 14:54:36 +0100 Subject: Fix #499 - Regression from 810a2fbc. --- debug_toolbar/toolbar.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'debug_toolbar') 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): -- cgit v1.2.3