-
Notifications
You must be signed in to change notification settings - Fork 14
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: wrap into try/except block getting icon for xblock #2509
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ | |
from web_fragments.fragment import Fragment | ||
from webob import Response | ||
from xblock.core import XBlock | ||
from xblock.exceptions import NoSuchServiceError | ||
from xblock.fields import Integer, ReferenceValueDict, Scope, String | ||
from xmodule.mako_block import MakoTemplateBlockBase | ||
from xmodule.modulestore.inheritance import UserPartitionList | ||
|
@@ -172,10 +173,14 @@ def child_block(self): | |
def child(self): | ||
""" | ||
Return the user bound child block for the partition or None. | ||
|
||
We are using try/except block here because we ran into issues with | ||
CachingDescriptorSystem has no attribute when we get an icon for the split_test xblock. | ||
""" | ||
if self.child_block is not None: | ||
try: | ||
return self.runtime.get_block_for_descriptor(self.child_block) | ||
else: | ||
except AttributeError: | ||
log.warning("Error while getting block for descriptor") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add a unique identifier (e.g. location), so it's possible to debug an error There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I also can't understand why you removed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Location added to both logs |
||
return None | ||
|
||
def get_child_block_by_location(self, location): | ||
|
@@ -212,8 +217,16 @@ def get_content_titles(self): | |
def get_child_blocks(self): | ||
""" | ||
For grading--return just the chosen child. | ||
|
||
We are using try/except block here because we ran into issues with | ||
User service being undefined when we get an icon for the split_test xblock. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Update docstring as in the previous function |
||
""" | ||
group_id = self.get_group_id() | ||
try: | ||
group_id = self.get_group_id() | ||
except NoSuchServiceError: | ||
log.warning("Error while getting user service in runtime") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add a unique identifier as in previous logging |
||
return [] | ||
|
||
if group_id is None: | ||
return [] | ||
|
||
|
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.
The comment should be changed specifying the technical issue
and note just -
we get an icon for the split_test xblock
e.g.
Handles the
AttributeError
exception that may occur when attempting to retrieve thesplit_test
xBlock information within the CMS.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.
Docstrings were changed