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
This commit is contained in:
Russell Keith-Magee 2010-01-31 23:38:17 +00:00
parent ee3132078d
commit 1f305a00a0
1 changed files with 10 additions and 6 deletions

View File

@ -26,6 +26,7 @@ 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.
""" """
try:
if HIDDEN_SETTINGS.search(key): if HIDDEN_SETTINGS.search(key):
cleansed = '********************' cleansed = '********************'
else: else:
@ -33,6 +34,9 @@ def cleanse_setting(key, value):
cleansed = dict((k, cleanse_setting(k, v)) for k,v in value.items()) cleansed = dict((k, cleanse_setting(k, v)) for k,v in value.items())
else: else:
cleansed = value 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():