Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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
  • Loading branch information...
commit 1f305a00a0dabd352ad9ceda5a35dedef4f72eb1 1 parent ee31320
Russell Keith-Magee freakboy3742 authored
Showing with 10 additions and 6 deletions.
  1. +10 −6 django/views/debug.py
16 django/views/debug.py
View
@@ -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():
Please sign in to comment.
Something went wrong with that request. Please try again.