-
Notifications
You must be signed in to change notification settings - Fork 4.2k
[BD-13] Deprecate ModuleSystem.render_template #28571
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
Conversation
|
Thanks for the pull request, @pomegranited! I've created BLENDED-947 to keep track of it in Jira. More details are on the BD-13 project page. When this pull request is ready, tag your edX technical lead. |
1c8b506 to
dc141f6
Compare
5a1698a to
96d9208
Compare
d30556f to
c3eb358
Compare
| This class is only intended to be used with an XBlock! | ||
| """ | ||
| _services_requested = { | ||
| 'mako': 'need', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
StudioEditableBlock needs the mako service now, but since it's not an XBlock, it doesn't have the _services_requested class property itself, so the XBlock.needs decorator causes this error on init:
AttributeError: type object 'StudioEditableBlock' has no attribute '_services_requested'
I borrowed this trick from AuthoringMixin, but an empty dict can perform the same duty, so I'll fix that here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eed7d32 to
a50742f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this raised in a test because otherwise this mixin should only be used as a mixin by other XBlocks. In that case maybe we can just make it inherit from XBlock instead?
|
@symbolist There's 1 error reported in the JS test, but it's unrelated to this work: Does this need to be resolved before merging? |
|
jenkins run js |
|
Ah, looks like that is being run by Github Actions now. |
fd844ee to
924d0d0
Compare
symbolist
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pomegranited Thanks!
- I tested this by viewing and editing all the XBlocks in the test course and confirming they are rendering.
- I read through the code
- I checked for accessibility issues. There are no UI changes.
- Includes documentation
|
@ormsbee This is ready to go! |
|
@pomegranited: I realize this is entirely my fault for sitting on this PR too long, but may I please ask for a rebase? I should be able to merge tomorrow morning. Thank you. |
in favor of the added MakoSystem render_template method. Related changes: * Adds the MakoService to the StudioEditModuleRuntime, PreviewModuleSystem, LmsModuleSystem, and XBlockRuntime * MakoService constructor takes a `namespace_prefix` string, so that the CMS PreviewModuleSystem can render to LMS templates, without needing the special render_from_lms helper method. * ModuleSystem.render_template becomes a read-only property, so the constructor calls and test module systems are updated accordingly. * Adds tests for the MakoService and module system shims.
924d0d0 to
26b4346
Compare
|
Your PR has finished running tests. There were no failures. |
|
@ormsbee No worries at all! Those conflicts are all from my other https://github.com/edx/edx-platform/pull/29190 that you just merged, so rebasing would have been a necessity either way. Fixed the conflicts and rebased, and the tests look good again, so this should be ready to merge now. Thank you! 😄 |
|
@pomegranited 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future. |
|
EdX Release Notice: This PR has been deployed to the staging environment in preparation for a release to production. |
|
EdX Release Notice: This PR has been deployed to the production environment. |
|
@pomegranited We were seeing issues with visibility settings for ORA and LTI blocks and the error "Error: service 'mako' was not requested", so we are going to revert this PR. |
|
Thanks for the heads up @dianakhuang and @jnlapierre -- if you could provide some details here, I'll address them with a follow-up PR. |
|
Thanks for the info @dianakhuang ! I can reproduce this on my devstack with ORA2, so will sort that one out. But I was unable to reproduce the issue with an LTI component, and (other than CC @jnlapierre |
|
@dianakhuang CC @jnlapierre I've identified the issue with ORA2, which was caused by a missed change to the AuthoringMixin, and would affect any XBlock which didn't explicitly But I'm re-submitting this PR, and will add a test to show the issue, then add the fix to show the issue has been resolved. |


Description
Builds on the shim added by https://github.com/edx/edx-platform/pull/28440 to deprecate the
ModuleSystem.render_templateattribute, in favor of using the addedMakoService.render_template.This change is only a refactoring, and should not affect Learners, Course Authors, or anyone else using edx-platform.
Supporting information
Testing instructions
LMS as learner:
honor@example.com/edx)LMS as course staff:
staff@example.com/edx)Studio:
staff@example.com/edx)Deadline
None