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)
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)
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)
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)
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')
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)
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)
def _commit(self, *a, **kw): Thing._commit(self, *a, **kw)