Fix versioned URLs for XBlock handlers in v2 runtime [FC-0062] - #35676
Conversation
|
Thanks for the pull request, @bradenmacdonald! What's next?Please work through the following steps to get your changes ready for engineering review: 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. 🔘 Let us know that your PR is ready for review:Who will review my changes?This repository is currently maintained by Where can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:
When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
8d10909 to
ea7b049
Compare
|
@ormsbee Could you take a look at this when you have time, please? |
| msg = f"XBlock {endpoint_parameters.get('block_key')} does not exist, or you don't have permission to view it." | ||
| self.assertEqual(response.json(), { | ||
| 'detail': msg, | ||
| }) |
There was a problem hiding this comment.
Because I moved the usage key parsing into Django's URL router, we still get a 404 response here but it's not a customized one for this API anymore.
ormsbee
left a comment
There was a problem hiding this comment.
Optional suggestion–not a blocker.
| raise NotFound(invalid_not_found_fmt.format(usage_key=usage_key_str)) from e | ||
|
|
||
| block = load_block(usage_key, request.user) | ||
| block = load_block(usage_key, request.user, version=parse_version_request(version)) |
There was a problem hiding this comment.
[Nit, optional]: Per your earlier convention, the version param passed into this view could be renamed version_str to clarify that it hasn't been parsed yet, or you could create another URL param converter to do the translation before it invokes the view.
There was a problem hiding this comment.
Sure - I pushed a commit with the URL param converter. I don't know if it's any cleaner than just using version_str, but I agree that doing one or the other is an improvement. Thx!
| from opaque_keys.edx.keys import UsageKeyV2 | ||
|
|
||
|
|
||
| class UsageKeyV2Converter: |
There was a problem hiding this comment.
I like that you're making one of these–I think it really helps clean things up.
9a166c2 to
a850821
Compare
|
2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production. |
|
2U Release Notice: This PR has been deployed to the edX production environment. |
Fixes #35673
Handlers weren't working in some cases if the handler URL contained a query string, due to assumptions made in the capa XBlock JS (and probably others).
This PR moves the version specifier into the URL path, instead of the query string. Also made some other cleanups.
How to test: