summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2010-01-31 23:38:17 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2010-01-31 23:38:17 +0000
commit1f305a00a0dabd352ad9ceda5a35dedef4f72eb1 (patch)
tree94eb6c559d6806b7d4db2b6c214925711185c773
parentee3132078d1c81490489fd989fd5d65581eb216b (diff)
Fixed #12744 -- Improved the settings cleansing process the work with dictionary settings that are keyed by non-strings. Thanks to minmax for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12361 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--django/views/debug.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/django/views/debug.py b/django/views/debug.py
index 18ee28b1f3..6efed55927 100644
--- a/django/views/debug.py
+++ b/django/views/debug.py
@@ -26,13 +26,17 @@ def cleanse_setting(key, value):
If the value is a dictionary, recursively cleanse the keys in
that dictionary.
"""
- if HIDDEN_SETTINGS.search(key):
- cleansed = '********************'
- else:
- if isinstance(value, dict):
- cleansed = dict((k, cleanse_setting(k, v)) for k,v in value.items())
+ try:
+ if HIDDEN_SETTINGS.search(key):
+ cleansed = '********************'
else:
- cleansed = value
+ if isinstance(value, dict):
+ cleansed = dict((k, cleanse_setting(k, v)) for k,v in value.items())
+ else:
+ cleansed = value
+ except TypeError:
+ # If the key isn't regex-able, just return as-is.
+ cleansed = value
return cleansed
def get_safe_settings():