diff options
| author | Jannis Leidel | 2013-12-09 18:58:15 +0100 | 
|---|---|---|
| committer | Jannis Leidel | 2013-12-09 18:58:15 +0100 | 
| commit | 810a2fbc5157f619eb3d74c73c882f059360506b (patch) | |
| tree | cce2010fe85ddbc9f388115d94267a6e709630fd /debug_toolbar/toolbar.py | |
| parent | e4fafb92377221201f9089aa972ac6c5504b45dd (diff) | |
| download | django-debug-toolbar-810a2fbc5157f619eb3d74c73c882f059360506b.tar.bz2 | |
Use collections.OrderedDict if available.
Diffstat (limited to 'debug_toolbar/toolbar.py')
| -rw-r--r-- | debug_toolbar/toolbar.py | 9 | 
1 files changed, 6 insertions, 3 deletions
| diff --git a/debug_toolbar/toolbar.py b/debug_toolbar/toolbar.py index 36c301a..82851b3 100644 --- a/debug_toolbar/toolbar.py +++ b/debug_toolbar/toolbar.py @@ -9,8 +9,11 @@ import uuid  from django.conf.urls import patterns, url  from django.core.exceptions import ImproperlyConfigured  from django.template.loader import render_to_string -from django.utils.datastructures import SortedDict  from django.utils.importlib import import_module +try: +    from collections import OrderedDict +except ImportError: +    from django.utils.datastructures import SortedDict as OrderedDict  from debug_toolbar import settings as dt_settings @@ -20,7 +23,7 @@ class DebugToolbar(object):      def __init__(self, request):          self.request = request          self.config = dt_settings.CONFIG.copy() -        self._panels = SortedDict() +        self._panels = OrderedDict()          for panel_class in self.get_panel_classes():              panel_instance = panel_class(self)              self._panels[panel_instance.panel_id] = panel_instance @@ -61,7 +64,7 @@ class DebugToolbar(object):      # Handle storing toolbars in memory and fetching them later on -    _store = SortedDict() +    _store = OrderedDict()      def should_render_panels(self):          render_panels = self.config['RENDER_PANELS'] | 
