-
Notifications
You must be signed in to change notification settings - Fork 27
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
Removing request content type configuration that cleans request data #27
Conversation
@SamambaMan could you explain what this change does, ie. why you think that code is incorrect? |
Senko, thanks for your attention. When posting data, using multipart/form-data, if this code is executed request.POST is cleaned. My method is:
if I do a:
I get a
Configured my url patterns this way:
After removing that code all posts works correctly. Is this the right fix? (i'm running python-2.7, django 1.10 and djangorestless 0.0.10, all downloaded using pip) Thanks in advance! |
Have you tried accessing |
Sure, request. data is also cleaned. A print request.data without the code comes with the data:
The same print with that line gets cleaned:
A few more information, thought, i'm using django restless since django 1.5 and recently i'v just update my entire application to django 1.10. Thanks! |
Ah, so it stopped working after upgrading to 1.10? I see, that’s definitely something we need to fix, but it’s going to be more complicated than removing this line, because it’s needed to pre-process the data. |
Senko, all right, i believe it may realy be more complicated than that. My system is on staging and removing that line and running tests worked for me, i'm going to live production that way, no problem. Thanks! |
I’ve taken a closer look and it seems that in Django 1.10, Django itself adds However, for earlier Django versions, it’s still needed, so instead of simpliy removing it, we should check to see if we have it, and add if not. I’ve made the change in #28 and it seems to behave nicely in tests. Can you check whether that branch works correctly for you? |
Assuming this is solved. |
After the execution of dispatch, the following code:
request.content_type = request.META.get('CONTENT_TYPE', 'text/plain')
The request contents (POST, body) are cleaned if the post is a multipart/form-data