fix: Fix KeyError in vertical_block
This now mimics the way this is (safely) done in the sequence module [1].
References:
- [1] 5f94a082ce/common/lib/xmodule/xmodule/seq_module.py (L657-L658)
This commit is contained in:
@@ -66,7 +66,9 @@ class VerticalBlock(SequenceFields, XModuleFields, StudioEditableBlock, XmlParse
|
||||
usage_key=self.location), # pylint: disable=no-member
|
||||
if 'username' not in child_context:
|
||||
user_service = self.runtime.service(self, 'user')
|
||||
child_context['username'] = user_service.get_current_user().opt_attrs['edx-platform.username']
|
||||
child_context['username'] = user_service.get_current_user().opt_attrs.get(
|
||||
'edx-platform.username'
|
||||
)
|
||||
|
||||
child_blocks = self.get_display_items()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user