diff options
| author | Aymeric Augustin | 2013-11-11 22:22:19 +0100 | 
|---|---|---|
| committer | Aymeric Augustin | 2013-11-11 22:56:29 +0100 | 
| commit | 9e06aa80a04e60506a0472e251e11b873eb8b501 (patch) | |
| tree | 3f1564e4dadba17a997e55fced8178194c36d70f /debug_toolbar | |
| parent | 54e69c49100be7205d1e8533ffa9373af074ed36 (diff) | |
| download | django-debug-toolbar-9e06aa80a04e60506a0472e251e11b873eb8b501.tar.bz2 | |
Make panels cache size configurable.
Diffstat (limited to 'debug_toolbar')
| -rw-r--r-- | debug_toolbar/toolbar/loader.py | 3 | ||||
| -rw-r--r-- | debug_toolbar/utils/settings.py | 1 | 
2 files changed, 2 insertions, 2 deletions
diff --git a/debug_toolbar/toolbar/loader.py b/debug_toolbar/toolbar/loader.py index 870eec3..f9262f8 100644 --- a/debug_toolbar/toolbar/loader.py +++ b/debug_toolbar/toolbar/loader.py @@ -100,7 +100,6 @@ def load_panel_classes():  toolbar_counter = 0 -toolbar_maxsize = 10            # keep data for the last 10 requests  toolbar_results = SortedDict() @@ -108,7 +107,7 @@ def save_toolbar(toolbar):      global toolbar_counter, toolbar_results      toolbar_counter += 1      toolbar_results[toolbar_counter] = toolbar -    for _ in range(len(toolbar_results) - toolbar_maxsize): +    for _ in range(len(toolbar_results) - CONFIG['RESULTS_CACHE_SIZE']):          # When we drop support for Python 2.6 and switch to          # collections.OrderedDict, use popitem(last=False).          del toolbar_results[toolbar_results.keyOrder[0]] diff --git a/debug_toolbar/utils/settings.py b/debug_toolbar/utils/settings.py index af9821f..12dc231 100644 --- a/debug_toolbar/utils/settings.py +++ b/debug_toolbar/utils/settings.py @@ -20,6 +20,7 @@ CONFIG_DEFAULTS = {      ),      'ROOT_TAG_ATTRS': '',      'SQL_WARNING_THRESHOLD': 500,   # milliseconds +    'RESULTS_CACHE_SIZE': 10,  }  | 
