Skip to content

Commit e7692b3

Browse files
committed
Rename storage to store to avoid conflicting with Django terminology.
1 parent a8a98dd commit e7692b3

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

debug_toolbar/static/debug_toolbar/js/toolbar.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@
2727
} else {
2828
$('.panelContent').hide(); // Hide any that are already open
2929
var inner = current.find('.djDebugPanelContent .scroll'),
30-
storage_id = $('#djDebug').data('storage-id'),
30+
store_id = $('#djDebug').data('store-id'),
3131
render_panel_url = $('#djDebug').data('render-panel-url');
32-
if (storage_id !== '' && inner.children().length === 0) {
32+
if (store_id !== '' && inner.children().length === 0) {
3333
var ajax_data = {
3434
data: {
35-
storage_id: storage_id,
35+
store_id: store_id,
3636
panel_id: this.className
3737
},
3838
type: 'GET',

debug_toolbar/templates/debug_toolbar/base.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<script src="{{ STATIC_URL }}debug_toolbar/js/jquery.cookie.js"></script>
1010
<script src="{{ STATIC_URL }}debug_toolbar/js/toolbar.js"></script>
1111
<div id="djDebug" style="display:none;" dir="ltr"
12-
data-storage-id="{{ toolbar.storage_id }}" data-render-panel-url="{% url 'djdt:render_panel' %}"
12+
data-store-id="{{ toolbar.store_id }}" data-render-panel-url="{% url 'djdt:render_panel' %}"
1313
{{ toolbar.config.ROOT_TAG_ATTRS|safe }}>
1414
<div style="display:none;" id="djDebugToolbar">
1515
<ul id="djDebugPanelList">
@@ -53,7 +53,7 @@ <h3>{{ panel.title|safe }}</h3>
5353
</div>
5454
<div class="djDebugPanelContent">
5555
<div class="scroll">
56-
{% if not toolbar.storage_id %}{{ panel.content }}{% endif %}
56+
{% if not toolbar.store_id %}{{ panel.content }}{% endif %}
5757
</div>
5858
</div>
5959
</div>

debug_toolbar/toolbar.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def __init__(self, request):
3030
panel_instance = panel_class(self, context=self.template_context)
3131
self._panels[panel_instance.panel_id] = panel_instance
3232
self.stats = {}
33-
self.storage_id = None
33+
self.store_id = None
3434

3535
# Manage panels
3636

@@ -67,7 +67,7 @@ def render_toolbar(self):
6767

6868
# Handle storing toolbars in memory and fetching them later on
6969

70-
_storage = SortedDict()
70+
_store = SortedDict()
7171

7272
def should_render_panels(self):
7373
render_panels = self.config['RENDER_PANELS']
@@ -76,17 +76,17 @@ def should_render_panels(self):
7676
return render_panels
7777

7878
def store(self):
79-
self.storage_id = uuid.uuid4().hex
79+
self.store_id = uuid.uuid4().hex
8080
cls = type(self)
81-
cls._storage[self.storage_id] = self
82-
for _ in range(len(cls._storage) - self.config['RESULTS_CACHE_SIZE']):
81+
cls._store[self.store_id] = self
82+
for _ in range(len(cls._store) - self.config['RESULTS_CACHE_SIZE']):
8383
# When we drop support for Python 2.6 and switch to
8484
# collections.OrderedDict, use popitem(last=False).
85-
del cls._storage[cls._storage.keyOrder[0]]
85+
del cls._store[cls._store.keyOrder[0]]
8686

8787
@classmethod
88-
def fetch(cls, storage_id):
89-
return cls._storage.get(storage_id)
88+
def fetch(cls, store_id):
89+
return cls._store.get(store_id)
9090

9191
# Manually implement class-level caching of panel classes and url patterns
9292
# because it's more obvious than going through an abstraction.

debug_toolbar/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
def render_panel(request):
1111
"""Render the contents of a panel"""
12-
toolbar = DebugToolbar.fetch(request.GET['storage_id'])
12+
toolbar = DebugToolbar.fetch(request.GET['store_id'])
1313
if toolbar is None:
1414
content = _("Data for this panel isn't available anymore. "
1515
"Please reload the page and retry.")

tests/test_integration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def test_basic(self):
136136
self.assertIn("Version", table.text)
137137

138138
@override_settings(DEBUG_TOOLBAR_CONFIG={'RESULTS_CACHE_SIZE': 0})
139-
def test_expired_storage(self):
139+
def test_expired_store(self):
140140
self.selenium.get(self.live_server_url + '/regular/basic/')
141141
version_panel = self.selenium.find_element_by_id('VersionsPanel')
142142

0 commit comments

Comments
 (0)