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

Request parsing when .POST accessed #3592

Merged
merged 2 commits into from
Nov 4, 2015

Conversation

tomchristie
Copy link
Member

Closes #3574.

@tomchristie tomchristie added the Bug label Nov 4, 2015
@tomchristie tomchristie added this to the 3.3.1 Release milestone Nov 4, 2015
tomchristie added a commit that referenced this pull request Nov 4, 2015
…ccessed

Request parsing when .POST accessed
@tomchristie tomchristie merged commit bfdf795 into master Nov 4, 2015
@tomchristie tomchristie deleted the request-parsing-when-post-accessed branch November 4, 2015 14:17
@babinos87
Copy link

Hi. Not sure if my issue is related to this fix, but this is what I have found til that moment.

Today I upgraded my DRF version to 3.3.1. In my application, I use django-rest-auth (version 0.5.0)
and django-allauth (version 0.24.1) for the sign-up mechanism that my app uses. Until now, the sign-up was working fine in version 3.2.3 that I used. After upgrading to 3.3.1, sign-up brokes. Trying to trace the issue, what I get as response is:

Request Method: POST
Request URL: http://localhost:8000/api/auth/registration/
Django Version: 1.8.6
Exception Type: AttributeError
Exception Value: can't set attribute

And it point to me at line 54 of views.py of rest-auth package:

rest_auth/registration/views.py Line 54 is:

self.request.POST = self.request.data.copy()

So, the above statement fails for DRF 3.3.1, although it was working in 3.2.3

Do you know why this could be failing? Should the changes you made for this bug affect the above command somehow?

Probably if this is the case there should be an update for allauth as I understand it is not your responsibility, but just wondering why after upgrading to DRF 3.3.1 got that issue, and any ideas on how I can overcome this.

Regards,
Babis

@babinos87
Copy link

Tried in both versions (3.3.1 and 3.2.3) and the self.request.data object is the same in both versions. So I suppose what fails is the assignment to the self.request.POST?

@babinos87
Copy link

The definition of post method in the file rest_auth/registration/views.py:

def post(self, request, *args, **kwargs):
    self.initial = {}
    self.request.POST = self.request.data.copy()     # This line breaks
    form_class = self.get_form_class()
    self.form = self.get_form(form_class)
    if self.form.is_valid():
        self.form_valid(self.form)
        return self.get_response()
    else:
        return self.get_response_with_errors()

@babinos87
Copy link

ok, found out that rest-auth had an issue with that upgrade, but the fix is out there, managed to update my rest-auth source and resolve my issue. False alarm then :)

Cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants