本文整理汇总了Python中sphinx.websupport.storage.sqlalchemystorage.Session.close方法的典型用法代码示例。如果您正苦于以下问题:Python Session.close方法的具体用法?Python Session.close怎么用?Python Session.close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sphinx.websupport.storage.sqlalchemystorage.Session
的用法示例。
在下文中一共展示了Session.close方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_moderation
# 需要导入模块: from sphinx.websupport.storage.sqlalchemystorage import Session [as 别名]
# 或者: from sphinx.websupport.storage.sqlalchemystorage.Session import close [as 别名]
def test_moderation(support):
session = Session()
nodes = session.query(Node).all()
node = nodes[7]
session.close()
accepted = support.add_comment('Accepted Comment', node_id=node.id,
displayed=False)
deleted = support.add_comment('Comment to delete', node_id=node.id,
displayed=False)
# Make sure the moderation_callback is called.
assert called
# Make sure the user must be a moderator.
raises(UserNotAuthorizedError, support.accept_comment, accepted['id'])
raises(UserNotAuthorizedError, support.delete_comment, deleted['id'])
support.accept_comment(accepted['id'], moderator=True)
support.delete_comment(deleted['id'], moderator=True)
comments = support.get_data(node.id)['comments']
assert len(comments) == 1
comments = support.get_data(node.id, moderator=True)['comments']
assert len(comments) == 1
示例2: get_comment
# 需要导入模块: from sphinx.websupport.storage.sqlalchemystorage import Session [as 别名]
# 或者: from sphinx.websupport.storage.sqlalchemystorage.Session import close [as 别名]
def get_comment():
session = Session()
node = session.query(Node).first()
session.close()
return support.get_data(node.id, moderator=True)['comments'][1]