'Replaces the values of variables marked as sensitive with
stars (*********).'

def get_traceback_frame_variables(self, request, tb_frame):

    current_frame = tb_frame.f_back
    sensitive_variables = None
    while (current_frame is not None):
        if ((current_frame.f_code.co_name == u'sensitive_variables_wrapper') and (u'sensitive_variables_wrapper' in current_frame.f_locals)):
            wrapper = current_frame.f_locals[u'sensitive_variables_wrapper']
            sensitive_variables = getattr(wrapper, u'sensitive_variables', None)
            break
        current_frame = current_frame.f_back
    cleansed = {}
    if (self.is_active(request) and sensitive_variables):
        if (sensitive_variables == u'__ALL__'):
            for (name, value) in tb_frame.f_locals.items():
                cleansed[name] = CLEANSED_SUBSTITUTE
        else:
            for (name, value) in tb_frame.f_locals.items():
                if (name in sensitive_variables):
                    value = CLEANSED_SUBSTITUTE
                else:
                    value = self.cleanse_special_types(request, value)
                cleansed[name] = value
    else:
        for (name, value) in tb_frame.f_locals.items():
            cleansed[name] = self.cleanse_special_types(request, value)
    if ((tb_frame.f_code.co_name == u'sensitive_variables_wrapper') and (u'sensitive_variables_wrapper' in tb_frame.f_locals)):
        cleansed[u'func_args'] = CLEANSED_SUBSTITUTE
        cleansed[u'func_kwargs'] = CLEANSED_SUBSTITUTE
    return cleansed.items()
