本文整理汇总了Python中r2.lib.db.thing.Thing._commit方法的典型用法代码示例。如果您正苦于以下问题:Python Thing._commit方法的具体用法?Python Thing._commit怎么用?Python Thing._commit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类r2.lib.db.thing.Thing
的用法示例。
在下文中一共展示了Thing._commit方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _commit
# 需要导入模块: from r2.lib.db.thing import Thing [as 别名]
# 或者: from r2.lib.db.thing.Thing import _commit [as 别名]
def _commit(self, *a, **kw):
"""Detect when we need to invalidate the sidebar recent posts.
Whenever a post is created we need to invalidate. Also invalidate when
various post attributes are changed (such as moving to a different
subreddit). If the post cache is invalidated the comment one is too.
This is primarily for when a post is banned so that its comments
dissapear from the sidebar too.
"""
should_invalidate = (not self._created or
frozenset(('title', 'sr_id', '_deleted', '_spam')) & frozenset(self._dirties.keys()))
Thing._commit(self, *a, **kw)
if should_invalidate:
g.rendercache.delete('side-posts' + '-' + c.site.name)
g.rendercache.delete('side-comments' + '-' + c.site.name)
tags = self.tag_names()
if 'open_thread' in tags:
g.rendercache.delete('side-open' + '-' + c.site.name)
if 'quotes' in tags:
g.rendercache.delete('side-quote' + '-' + c.site.name)
if 'group_rationality_diary' in tags:
g.rendercache.delete('side-diary' + '-' + c.site.name)
示例2: _commit
# 需要导入模块: from r2.lib.db.thing import Thing [as 别名]
# 或者: from r2.lib.db.thing.Thing import _commit [as 别名]
def _commit(self, *a, **kw):
"""Detect when we need to invalidate the sidebar recent comments.
Whenever a comment is created we need to invalidate. Also
invalidate when various comment attributes are changed.
"""
should_invalidate = (not self._created or
frozenset(('body', '_deleted', '_spam')) & frozenset(self._dirties.keys()))
Thing._commit(self, *a, **kw)
if should_invalidate:
g.rendercache.delete('side-comments' + '-' + c.site.name)
示例3: _commit
# 需要导入模块: from r2.lib.db.thing import Thing [as 别名]
# 或者: from r2.lib.db.thing.Thing import _commit [as 别名]
def _commit(self, *a, **kw):
"""Detect when we need to invalidate the sidebar recent posts.
Whenever a post is created we need to invalidate. Also
invalidate when various post attributes are changed (such as
moving to a different subreddit).
"""
should_invalidate = (not self._created or
frozenset(('title', 'sr_id', '_deleted', '_spam')) & frozenset(self._dirties.keys()))
Thing._commit(self, *a, **kw)
if should_invalidate:
g.rendercache.delete('side-posts')
示例4: _commit
# 需要导入模块: from r2.lib.db.thing import Thing [as 别名]
# 或者: from r2.lib.db.thing.Thing import _commit [as 别名]
def _commit(self, *a, **kw):
Thing._commit(self, *a, **kw)