diff options
| author | Julien Phalip <jphalip@gmail.com> | 2012-06-03 17:33:09 -0700 |
|---|---|---|
| committer | Julien Phalip <jphalip@gmail.com> | 2012-06-03 23:44:13 -0700 |
| commit | f699641161a4ec8b6cbee938fd3a4379e7889ff2 (patch) | |
| tree | ae810a7f36c809d54a0735351ef94fd4d5d3f956 /django/views/debug.py | |
| parent | f29234167ad0193f35360023c65212c39cf87d1b (diff) | |
Fixed #17138 -- Made the sensitive_variables decorator work with object methods.
Diffstat (limited to 'django/views/debug.py')
| -rw-r--r-- | django/views/debug.py | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/django/views/debug.py b/django/views/debug.py index 7bdf0d25ee..d95cd62017 100644 --- a/django/views/debug.py +++ b/django/views/debug.py @@ -155,9 +155,20 @@ class SafeExceptionReporterFilter(ExceptionReporterFilter): Replaces the values of variables marked as sensitive with stars (*********). """ - func_name = tb_frame.f_code.co_name - func = tb_frame.f_globals.get(func_name) - sensitive_variables = getattr(func, 'sensitive_variables', []) + # Loop through the frame's callers to see if the sensitive_variables + # decorator was used. + current_frame = tb_frame.f_back + sensitive_variables = None + while current_frame is not None: + if (current_frame.f_code.co_name == 'sensitive_variables_wrapper' + and 'sensitive_variables_wrapper' in current_frame.f_locals): + # The sensitive_variables decorator was used, so we take note + # of the sensitive variables' names. + wrapper = current_frame.f_locals['sensitive_variables_wrapper'] + sensitive_variables = getattr(wrapper, 'sensitive_variables', None) + break + current_frame = current_frame.f_back + cleansed = [] if self.is_active(request) and sensitive_variables: if sensitive_variables == '__ALL__': |
