本文整理汇总了Python中opaque_keys.edx.keys.AssetKey.set_deprecated_fallback方法的典型用法代码示例。如果您正苦于以下问题:Python AssetKey.set_deprecated_fallback方法的具体用法?Python AssetKey.set_deprecated_fallback怎么用?Python AssetKey.set_deprecated_fallback使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类opaque_keys.edx.keys.AssetKey
的用法示例。
在下文中一共展示了AssetKey.set_deprecated_fallback方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: tag
# 需要导入模块: from opaque_keys.edx.keys import AssetKey [as 别名]
# 或者: from opaque_keys.edx.keys.AssetKey import set_deprecated_fallback [as 别名]
@property
def tag(self):
"""Returns the deprecated tag for this Location."""
return self.DEPRECATED_TAG
@classmethod
def _from_deprecated_string(cls, serialized):
match = cls.ASSET_URL_RE.match(serialized)
if match is None:
raise InvalidKeyError(cls, serialized)
groups = match.groupdict()
course_key = CourseLocator(
groups['org'],
groups['course'],
None,
groups.get('revision', None),
deprecated=True
)
return cls(course_key, groups['category'], groups['name'], deprecated=True)
def to_deprecated_list_repr(self):
"""
Thumbnail locations are stored as lists [c4x, org, course, thumbnail, path, None] in contentstore.mongo
That should be the only use of this method, but the method is general enough to provide the pre-opaque
Location fields as an array in the old order with the tag.
"""
return ['c4x', self.org, self.course, self.block_type, self.name, None]
# Register AssetLocator as the deprecated fallback for AssetKey
AssetKey.set_deprecated_fallback(AssetLocator)