本文整理汇总了Python中tracim.lib.content.ContentApi.get_canonical_query方法的典型用法代码示例。如果您正苦于以下问题:Python ContentApi.get_canonical_query方法的具体用法?Python ContentApi.get_canonical_query怎么用?Python ContentApi.get_canonical_query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tracim.lib.content.ContentApi
的用法示例。
在下文中一共展示了ContentApi.get_canonical_query方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _create_content_and_test
# 需要导入模块: from tracim.lib.content import ContentApi [as 别名]
# 或者: from tracim.lib.content.ContentApi import get_canonical_query [as 别名]
def _create_content_and_test(self, name, workspace, *args, **kwargs) -> Content:
"""
All extra parameters (*args, **kwargs) are for Content init
:return: Created Content instance
"""
content = Content(*args, **kwargs)
content.label = name
content.workspace = workspace
DBSession.add(content)
DBSession.flush()
eq_(1, ContentApi.get_canonical_query().filter(Content.label == name).count())
return ContentApi.get_canonical_query().filter(Content.label == name).one()
示例2: test_children
# 需要导入模块: from tracim.lib.content import ContentApi [as 别名]
# 或者: from tracim.lib.content.ContentApi import get_canonical_query [as 别名]
def test_children(self):
admin = DBSession.query(User).filter(User.email == '[email protected]').one()
self._create_thread_and_test(
workspace_name='workspace_1',
folder_name='folder_1',
thread_name='thread_1',
user=admin
)
workspace = DBSession.query(Workspace).filter(Workspace.label == 'workspace_1').one()
folder = ContentApi.get_canonical_query().filter(Content.label == 'folder_1').one()
eq_([folder, ], list(workspace.get_valid_children()))