@@ -486,12 +486,12 @@ def add_xml_to_node(self, node):
486486 aside .add_xml_to_node (aside_node )
487487 xml_object .append (aside_node )
488488
489- not_to_clean_fields = self .metadata_to_not_to_clean .get (self .category , ())
489+ not_to_clean_fields = self .metadata_to_not_to_clean .get (self .scope_ids . block_type , ())
490490 self .clean_metadata_from_xml (xml_object , excluded_fields = not_to_clean_fields )
491491
492492 # Set the tag on both nodes so we get the file path right.
493- xml_object .tag = self .category
494- node .tag = self .category
493+ xml_object .tag = self .scope_ids . block_type
494+ node .tag = self .scope_ids . block_type
495495
496496 # Add the non-inherited metadata
497497 for attr in sorted (own_metadata (self )):
@@ -506,7 +506,7 @@ def add_xml_to_node(self, node):
506506 logging .exception (
507507 'Failed to serialize metadata attribute %s with value %s in module %s. '
508508 'This could mean data loss!!!' ,
509- attr , val , self .url_name
509+ attr , val , self .scope_ids . usage_id . block_id
510510 )
511511
512512 for key , value in self .xml_attributes .items ():
@@ -515,8 +515,8 @@ def add_xml_to_node(self, node):
515515
516516 if self .export_to_file ():
517517 # Write the definition to a file
518- url_path = name_to_pathname (self .url_name )
519- filepath = self ._format_filepath (self .category , url_path )
518+ url_path = name_to_pathname (self .scope_ids . usage_id . block_id )
519+ filepath = self ._format_filepath (self .scope_ids . block_type , url_path )
520520 self .runtime .export_fs .makedirs (os .path .dirname (filepath ), recreate = True )
521521 with self .runtime .export_fs .open (filepath , 'wb' ) as fileobj :
522522 ElementTree (xml_object ).write (fileobj , pretty_print = True , encoding = 'utf-8' )
@@ -531,16 +531,16 @@ def add_xml_to_node(self, node):
531531
532532 # Do not override an existing value for the course.
533533 if not node .get ('url_name' ):
534- node .set ('url_name' , self .url_name )
534+ node .set ('url_name' , self .scope_ids . usage_id . block_id )
535535
536536 # We do not need to cater the `course` category here in xblocks_contrib,
537537 # because course export is handled in the edx-platform code.
538538
539539 # Special case for course pointers:
540- # if self.category == 'course':
540+ # if self.scope_ids.block_type == 'course':
541541 # # add org and course attributes on the pointer tag
542- # node.set('org', self.location .org)
543- # node.set('course', self.location .course)
542+ # node.set('org', self.scope_ids.usage_id .org)
543+ # node.set('course', self.scope_ids.usage_id .course)
544544
545545 def definition_to_xml (self , resource_fs ):
546546 """
0 commit comments