-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle list post data #73
Handle list post data #73
Conversation
@@ -120,17 +120,23 @@ def _clean_data(self, data): | |||
You can define your own sensitive fields in your view by defining a set | |||
eg: sensitive_fields = {'field1', 'field2'} | |||
""" | |||
data = dict(data) | |||
# data = dict(data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is needed (maybe not there) otherwise you'll modify the original values which you don't want
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for me this was giving error that's why I commented the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I totally understand but this is critical, if you don't do it, you will have other errors. Again you don't want to modify the data you send to your API
rest_framework_tracking/mixins.py
Outdated
@@ -143,4 +151,4 @@ class LoggingErrorsMixin(BaseLoggingMixin): | |||
Log only errors | |||
""" | |||
def _should_log(self, request, response): | |||
return response.status_code >= 400 | |||
i return response.status_code >= 400 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you have a typo here
data = dict(data) | ||
for key in data: | ||
if key.lower() in SENSITIVE_FIELDS: | ||
data[key] = CLEANED_SUBSTITUTE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We duplicate a lot of code here, instead of doing what you do we could have:
if type(data) is not list:
data_list = [data]
for data in data_list:
d = dict(data)
for key in d:
if key.lower() in SENSITIVE_FIELDS:
d[key] = CLEANED_SUBSTITUTE
return d
@triat @verisadmin This was fixed and merged from PR #80 |
Fix #71