aboutsummaryrefslogtreecommitdiffstats
path: root/debug_toolbar/toolbar.py
diff options
context:
space:
mode:
authorAymeric Augustin2013-11-15 22:25:33 +0100
committerAymeric Augustin2013-11-15 22:25:33 +0100
commitf0d0ddbada065ec0ff4fc64aed9d2f9ba48ba5a3 (patch)
tree212c735532eedcdd643de7f1af929d6aa5628aa7 /debug_toolbar/toolbar.py
parente2a053a9679616b0141a1cec15c237ca8fbc976a (diff)
downloaddjango-debug-toolbar-f0d0ddbada065ec0ff4fc64aed9d2f9ba48ba5a3.tar.bz2
Switch to random storage ids to avoid exposing information.
Diffstat (limited to 'debug_toolbar/toolbar.py')
-rw-r--r--debug_toolbar/toolbar.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/debug_toolbar/toolbar.py b/debug_toolbar/toolbar.py
index 992e4a8..acb86d9 100644
--- a/debug_toolbar/toolbar.py
+++ b/debug_toolbar/toolbar.py
@@ -4,6 +4,8 @@ The main DebugToolbar class that loads and renders the Toolbar.
from __future__ import unicode_literals
+import uuid
+
from django.conf import settings
from django.conf.urls import patterns, url
from django.core.exceptions import ImproperlyConfigured
@@ -62,7 +64,6 @@ class DebugToolbar(object):
# Handle storing toolbars in memory and fetching them later on
- _counter = 0
_storage = SortedDict()
def should_render_panels(self):
@@ -72,14 +73,14 @@ class DebugToolbar(object):
return render_panels
def store(self):
+ storage_id = uuid.uuid4().hex
cls = type(self)
- cls._counter += 1
- cls._storage[cls._counter] = self
+ cls._storage[storage_id] = self
for _ in range(len(cls._storage) - dt_settings.CONFIG['RESULTS_CACHE_SIZE']):
# When we drop support for Python 2.6 and switch to
# collections.OrderedDict, use popitem(last=False).
del cls._storage[cls._storage.keyOrder[0]]
- return cls._counter
+ return storage_id
@classmethod
def fetch(cls, storage_id):