本文整理汇总了Python中tracim_backend.lib.core.content.ContentApi.get_one_by_filename_and_parent_labels方法的典型用法代码示例。如果您正苦于以下问题:Python ContentApi.get_one_by_filename_and_parent_labels方法的具体用法?Python ContentApi.get_one_by_filename_and_parent_labels怎么用?Python ContentApi.get_one_by_filename_and_parent_labels使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tracim_backend.lib.core.content.ContentApi
的用法示例。
在下文中一共展示了ContentApi.get_one_by_filename_and_parent_labels方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _get_content
# 需要导入模块: from tracim_backend.lib.core.content import ContentApi [as 别名]
# 或者: from tracim_backend.lib.core.content.ContentApi import get_one_by_filename_and_parent_labels [as 别名]
def _get_content(self, content_path_fetcher):
path = content_path_fetcher()
content_path = self.reduce_path(path)
splited_local_path = content_path.strip('/').split('/')
workspace_name = webdav_convert_file_name_to_bdd(splited_local_path[0])
wapi = WorkspaceApi(
current_user=self.current_user,
session=self.dbsession,
config=self.app_config,
)
workspace = wapi.get_one_by_label(workspace_name)
parents = []
if len(splited_local_path) > 2:
parent_string = splited_local_path[1:-1]
parents = [webdav_convert_file_name_to_bdd(x) for x in parent_string]
content_api = ContentApi(
config=self.app_config,
current_user=self.current_user,
session=self.dbsession
)
return content_api.get_one_by_filename_and_parent_labels(
content_label=webdav_convert_file_name_to_bdd(basename(path)),
content_parent_labels=parents,
workspace=workspace,
)