Skip to content

Commit

Permalink
Fixed #12744 -- Improved the settings cleansing process the work with…
Browse files Browse the repository at this point in the history
… 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
freakboy3742 committed Jan 31, 2010
1 parent ee31320 commit 1f305a0
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions django/views/debug.py
Expand Up @@ -26,13 +26,17 @@ def cleanse_setting(key, value):
If the value is a dictionary, recursively cleanse the keys in If the value is a dictionary, recursively cleanse the keys in
that dictionary. that dictionary.
""" """
if HIDDEN_SETTINGS.search(key): try:
cleansed = '********************' if HIDDEN_SETTINGS.search(key):
else: cleansed = '********************'
if isinstance(value, dict):
cleansed = dict((k, cleanse_setting(k, v)) for k,v in value.items())
else: 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 return cleansed


def get_safe_settings(): def get_safe_settings():
Expand Down

0 comments on commit 1f305a0

Please sign in to comment.