-
Notifications
You must be signed in to change notification settings - Fork 219
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
fix: throw an error if the scope if None on scope_mappings [FC-0076] #815
fix: throw an error if the scope if None on scope_mappings [FC-0076] #815
Conversation
Thanks for the pull request, @rpenido! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review.
|
a064796
to
e0df689
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.
👍 Fixes the issue, thanks @rpenido !
- I tested this on my tutor dev stack in conjunction with fix: advanced editor styling on library authoring [FC-0076] edx-platform#36146, by saving changes to the Survey & Poll XBlocks
- I read through the code
-
I checked for accessibility issuesN/A - Includes documentation - inline code comment explaining the change
-
User-facing strings are extracted for translationN/A
xblock/core.py
Outdated
@@ -687,7 +687,7 @@ class XBlock(Plugin, Blocklike, metaclass=_HasChildrenMetaclass): | |||
|
|||
# These are dynamically managed by the awful hackery of _HasChildrenMetaclass. | |||
# We just declare their types here to make static analyzers happy. | |||
# Note that children is only defined iff has_children is defined and True. | |||
# Note that children is only defined if has_children is defined and True. |
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.
nit: this comment change can be reverted -- iff is a shorthand term for "if and only if"
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.
I didn't know that! Thanks @pomegranited!!
I dropped the commit.
97295cc
to
e0df689
Compare
Hi @pdpinch, @ormsbee and @felipemontoya! |
52e5ab3
to
6998e09
Compare
584a398
to
ab63faf
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.
Thanks, seems good, just a minor request.
xblock/field_data.py
Outdated
@@ -148,7 +148,12 @@ def _field_data(self, block, name): | |||
if scope not in self._scope_mappings: | |||
raise InvalidScopeError(scope) |
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.
Isn't this line trying to do something similar? Maybe you can consolidate these two conditions using self._scope_mappings.get(...)
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.
Done: e048432
ab63faf
to
e048432
Compare
Approved! Can you try squashing and/or rebasing this? I'm not sure why the docs check hasn't passed, but it's blocking me from merging. |
Also, please include a version bump if you'd like to. But it's also fine to just leave this "unreleased" and wait until it gets combined with some other changes. With the other fix we have in place, I don't think this PR is urgent anymore. |
40cf647
to
bdd479b
Compare
Squased and Rebased! |
Closed and re-opened to see if that will fix the docs check. |
Thanks for merging it @bradenmacdonald! |
@rpenido Ah, I tagged it but I guess that wasn't enough. I've done a release now too. |
Description
While using the XBlock API, we may not have a
FieldSet
for a specific scope, which resulted inAttributeError: 'NoneType' object has no attribute 'foo'
errors.With this PR, the
InvalidScopeError
is now thrown in these cases.Testing instructions
Survey
block on the Library Authoring page and check the error below (before fix: always define a student_data_store to prevent errors on XBlock load [FC-0076] edx-platform#36226)InvalidScopeError
Private ref: FAL-4033