本文整理汇总了Python中tracim.lib.content.ContentApi.get_all_types方法的典型用法代码示例。如果您正苦于以下问题:Python ContentApi.get_all_types方法的具体用法?Python ContentApi.get_all_types怎么用?Python ContentApi.get_all_types使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tracim.lib.content.ContentApi
的用法示例。
在下文中一共展示了ContentApi.get_all_types方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_one
# 需要导入模块: from tracim.lib.content import ContentApi [as 别名]
# 或者: from tracim.lib.content.ContentApi import get_all_types [as 别名]
def get_one(self, folder_id):
folder_id = int(folder_id)
user = tmpl_context.current_user
workspace = tmpl_context.workspace
workspace_id = tmpl_context.workspace_id
current_user_content = Context(CTX.CURRENT_USER,
current_user=user).toDict(user)
current_user_content.roles.sort(key=lambda role: role.workspace.name)
content_api = ContentApi(user)
folder = content_api.get_one(folder_id, ContentType.Folder, workspace)
fake_api_breadcrumb = self.get_breadcrumb(folder_id)
fake_api_subfolders = self.get_all_fake(workspace, folder.content_id).result
fake_api_pages = self.pages.get_all_fake(workspace, folder).result
fake_api_files = self.files.get_all_fake(workspace, folder).result
fake_api_threads = self.threads.get_all_fake(workspace, folder).result
fake_api_content = DictLikeClass(
current_user=current_user_content,
breadcrumb=fake_api_breadcrumb,
current_folder_subfolders=fake_api_subfolders,
current_folder_pages=fake_api_pages,
current_folder_files=fake_api_files,
current_folder_threads=fake_api_threads,
)
fake_api = Context(CTX.FOLDER).toDict(fake_api_content)
fake_api.sub_items = Context(CTX.FOLDER_CONTENT_LIST).toDict(
folder.get_valid_children([ContentType.Folder,
ContentType.File,
ContentType.Page,
ContentType.Thread]))
fake_api.content_types = Context(CTX.DEFAULT).toDict(
content_api.get_all_types())
dictified_folder = Context(CTX.FOLDER).toDict(folder, 'folder')
return DictLikeClass(result = dictified_folder, fake_api=fake_api)