""" course_key = CourseLocator( id_dict['org'], id_dict['course'], run, id_dict['revision'], deprecated=True, ) return cls(course_key, id_dict['category'], id_dict['name'], deprecated=True) # register BlockUsageLocator as the deprecated fallback for UsageKey UsageKey.set_deprecated_fallback(BlockUsageLocator) class LibraryUsageLocator(BlockUsageLocator): """ Just like BlockUsageLocator, but this points to a block stored in a library, not a course. """ CANONICAL_NAMESPACE = 'lib-block-v1' KEY_FIELDS = ('library_key', 'block_type', 'block_id') # fake out class introspection as this is an attr in this class's instances library_key = None block_type = None def __init__(self, library_key, block_type, block_id, **kwargs):
@classmethod def _from_deprecated_son(cls, id_dict, run): """ Return the Location decoding this id_dict and run """ course_key = CourseLocator( id_dict['org'], id_dict['course'], run, id_dict['revision'], deprecated=True, ) return cls(course_key, id_dict['category'], id_dict['name'], deprecated=True) # register BlockUsageLocator as the deprecated fallback for UsageKey UsageKey.set_deprecated_fallback(BlockUsageLocator) class LibraryUsageLocator(BlockUsageLocator): """ Just like BlockUsageLocator, but this points to a block stored in a library, not a course. """ CANONICAL_NAMESPACE = 'lib-block-v1' KEY_FIELDS = ('library_key', 'block_type', 'block_id') # fake out class introspection as this is an attr in this class's instances library_key = None block_type = None def __init__(self, library_key, block_type, block_id, **kwargs):