Skip to content

Commit e8b023c

Browse files
committed
feat: remove legacy attrs from extracted annotatable, html & problem block
1 parent 9b642be commit e8b023c

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

xmodule/conditional_block.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,9 @@ def student_view(self, _context):
222222
return fragment
223223

224224
def get_html(self):
225-
required_html_ids = [block.location.html_id() for block in self.get_required_blocks]
225+
required_html_ids = [block.usage_key.html_id() for block in self.get_required_blocks]
226226
return self.runtime.service(self, 'mako').render_lms_template('conditional_ajax.html', {
227-
'element_id': self.location.html_id(),
227+
'element_id': self.usage_key.html_id(),
228228
'ajax_url': self.ajax_url,
229229
'depends': ';'.join(required_html_ids)
230230
})

xmodule/tests/test_conditional.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ def create(system, source_is_error_block=False, source_visible_to_staff_only=Fal
8484
else:
8585
source_block = Mock(name='source_block')
8686
source_block.location = source_location
87+
source_block.usage_key = source_location
8788

8889
source_block.visible_to_staff_only = source_visible_to_staff_only
8990
source_block.runtime = system
@@ -97,6 +98,7 @@ def create(system, source_is_error_block=False, source_visible_to_staff_only=Fal
9798
child_block.runtime = system
9899
child_block.render = lambda view, context=None: system.render(child_block, view, context)
99100
child_block.location = source_location.replace(category='html', name='child')
101+
child_block.usage_key = child_block.location
100102

101103
def visible_to_nonstaff_users(desc):
102104
"""
@@ -121,7 +123,7 @@ def load_item(usage_id, for_parent=None): # pylint: disable=unused-argument
121123
'conditional_attr': 'attempted',
122124
'conditional_value': 'true',
123125
'xml_attributes': {'attempted': 'true'},
124-
'children': [child_block.location],
126+
'children': [child_block.usage_key],
125127
})
126128

127129
cond_block = ConditionalBlock(

0 commit comments

Comments
 (0)