Skip to content
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

Conversation

veris-neerajdhiman
Copy link

Fix #71

@@ -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)
Copy link
Contributor

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

Copy link
Author

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.

Copy link
Contributor

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

@@ -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
Copy link
Contributor

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
Copy link
Contributor

@triat triat Sep 13, 2017

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 triat mentioned this pull request Oct 17, 2017
@avelis
Copy link
Collaborator

avelis commented Oct 27, 2017

@triat @verisadmin This was fixed and merged from PR #80

@avelis avelis closed this Oct 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants