Skip to content

Commit c20e83f

Browse files
committed
Correct some issues with the stats methods
1 parent 78a8b44 commit c20e83f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

debug_toolbar/panels/__init__.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,14 @@ def content(self):
4141
raise NotImplementedError
4242

4343
def record_stats(self, stats):
44-
self.toolbar.stats[self.slug].update(stats)
44+
panel_stats = self.toolbar.stats.get(self.slug)
45+
if panel_stats:
46+
panel_stats.update(stats)
47+
else:
48+
self.toolbar.stats[self.slug] = stats
4549

4650
def get_stats(self):
47-
return self.toolbar.stats[self.slug]
51+
return self.toolbar.stats.get(self.slug, {})
4852

4953
# Standard middleware methods
5054
def process_request(self, request):

0 commit comments

Comments
 (0)