本文整理汇总了Python中opencontext_py.libs.rootpath.RootPath.convert_local_url方法的典型用法代码示例。如果您正苦于以下问题:Python RootPath.convert_local_url方法的具体用法?Python RootPath.convert_local_url怎么用?Python RootPath.convert_local_url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类opencontext_py.libs.rootpath.RootPath
的用法示例。
在下文中一共展示了RootPath.convert_local_url方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: parse_json_option
# 需要导入模块: from opencontext_py.libs.rootpath import RootPath [as 别名]
# 或者: from opencontext_py.libs.rootpath.RootPath import convert_local_url [as 别名]
def parse_json_option(self, json_option):
""" parses json option to populate
this object
"""
if 'id' in json_option:
self.id = json_option['id']
if 'json' in json_option:
self.json = json_option['json']
if 'label' in json_option:
self.label = json_option['label']
if 'count' in json_option:
self.count = json_option['count']
if 'slug' in json_option:
self.slug = json_option['slug']
if 'rdfs:isDefinedBy' in json_option:
if 'http://' in json_option['rdfs:isDefinedBy'] \
or 'https://' in json_option['rdfs:isDefinedBy']:
# assign this to a subheading
self.set_sub_heading(json_option['rdfs:isDefinedBy'])
rp = RootPath()
self.defined_by = rp.convert_local_url(json_option['rdfs:isDefinedBy'])
self.dom_id = self.dom_id_prefix + '---' + str(self.slug)
# check to see if we should show this, based in if this is a related property
# and if self.item_type_limited is False
self.check_show_related_options()
示例2: parse_json_option
# 需要导入模块: from opencontext_py.libs.rootpath import RootPath [as 别名]
# 或者: from opencontext_py.libs.rootpath.RootPath import convert_local_url [as 别名]
def parse_json_option(self, json_option):
""" parses json option to populate
this object
"""
if 'id' in json_option:
self.id = json_option['id']
if 'json' in json_option:
self.json = json_option['json']
if 'label' in json_option:
self.label = json_option['label']
if 'count' in json_option:
self.count = json_option['count']
if 'slug' in json_option:
self.slug = json_option['slug']
if 'rdfs:isDefinedBy' in json_option:
if 'http://' in json_option['rdfs:isDefinedBy'] \
or 'https://' in json_option['rdfs:isDefinedBy']:
rp = RootPath()
self.defined_by = rp.convert_local_url(json_option['rdfs:isDefinedBy'])
self.dom_id = self.dom_id_prefix + '---' + str(self.slug)