Patch the bulk_enroll request to use a form content type - #15631
Conversation
Setting the content type to be form data makes Django Rest Framework v3.6.3 treat all passed JSON data as POST parameters. This is necessary because this request is forwarded on to the student_update_enrollment view, which requires all of the parameters to be passed in via POST parameters.
|
Thanks for the pull request, @bdero! It looks like you're a member of a company that does contract work for edX. If you're doing this work as part of a paid contract with edX, you should talk to edX about who will review this pull request. If this work is not part of a paid contract with edX, then you should ensure that there is an OSPR issue to track this work in JIRA, so that we don't lose track of your pull request. |
|
Thanks for the pull request, @bdero! I've created OSPR-1835 to keep track of it in JIRA. JIRA is a place for product owners to prioritize feature reviews by the engineering development teams. Feel free to add as much of the following information to the ticket:
All technical communication about the code itself will still be done via the GitHub pull request interface. As a reminder, our process documentation is here. |
pomegranited
left a comment
There was a problem hiding this comment.
@bdero 👍
- I tested this on my devstack and the sandbox using the test instructions and feature settings on https://github.com/edx/edx-platform/pull/15579, and verified the absence of the
errorkey in the responses. - I read through the code
-
I checked for accessibility issuesAffects API calls, not GUI - Includes documentation - inline docs clearly explain the issue.
| # POST parameters. This is necessary because this request is forwarded on to the student_update_enrollment | ||
| # view, which requires all of the parameters to be passed in via POST parameters. | ||
| metadata = request._request.META # pylint: disable=protected-access | ||
| metadata['CONTENT_TYPE'] = 'application/x-www-form-urlencoded' |
There was a problem hiding this comment.
I see - so that was the origin of the previous line which modified the request. 👍 for the comment.
|
EdX Release Notice: This PR has been deployed to the staging environment in preparation for a release to production on Monday, July 24, 2017. |
|
@pomegranited @brittneyexline @doctoryes Thank you! |
|
EdX Release Notice: This PR has been deployed to the production environment. |
|
EdX Release Notice: This PR has been rolled back from the production environment. |
The plot thickens with with yet another follow-up fix (related to https://github.com/edx/edx-platform/pull/15584). :) It turns out that the line removed there was necessary for older versions of DRF. I neglected to notice that buried in the response that I received back during testing was actually an error from the downstream
student_update_enrollmentview. Because that view directly pulls the parameters out of POST data, certain conditions need to be met in order for DRF to pull POST data from the "_data" dict.From my inline comment:
JIRA tickets: OSPR-1835
Dependencies: None
Sandbox URL: TBD - sandbox is being provisioned.
Testing instructions:
Follow the exact same testing instructions that are listed in #15579, except be sure to double-check that the response does NOT contain an error field.
Reviewers
Settings