Example #1
0
    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)
Example #2
0
    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)
Example #3
0
    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)
Example #4
0
    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)
Example #5
0
    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')
Example #6
0
    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)
            tags = Link._byID(self.link_id, data = True).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)
Example #7
0
    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)
            tags = Link._byID(self.link_id, data=True).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)
Example #8
0
    def _commit(self, *a, **kw):

        Thing._commit(self, *a, **kw)