当前位置: 首页>>代码示例>>Python>>正文


Python Thing._commit方法代码示例

本文整理汇总了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)
开发者ID:brendanlong,项目名称:lesswrong,代码行数:27,代码来源:link.py

示例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)
开发者ID:Craigus,项目名称:lesswrong,代码行数:16,代码来源:link.py

示例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')
开发者ID:Kakun1,项目名称:lesswrong,代码行数:17,代码来源:link.py

示例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)
开发者ID:JoshuaDavid,项目名称:lesswrong-1,代码行数:5,代码来源:award.py


注:本文中的r2.lib.db.thing.Thing._commit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。