if isinstance(obj, Publishable) and obj.is_published(): publishable_published(obj, delta=1) # invalidate the objects boxes invalidate_cache_for_object(obj) def publishable_unpublished(publishable, **kwargs): pipe = None for lh in _get_listing_handlers(): pipe = lh.remove_publishable(publishable.category, publishable, pipe=pipe, commit=False) if pipe: pipe.execute() def publishable_published(publishable, delta=0, **kwargs): pipe = None for lh in _get_listing_handlers(): if issubclass(lh, SlidingListingHandler): if delta != 0: pipe = lh.incr_score(publishable.category, publishable, incr_by=delta, pipe=pipe, commit=False) else: pipe = lh.add_publishable(publishable.category, publishable, pipe=pipe, commit=False) if pipe: pipe.execute() content_published.connect(publishable_published) content_unpublished.connect(publishable_unpublished) comment_was_posted.connect(comment_posted, sender=FlatComment) comment_was_moderated.connect(comment_moderated, sender=FlatComment)
def setUp(self): super(TestForm, self).setUp() comment_was_posted.connect(self._comment_posted) self._posted = []
pipe=pipe, commit=False) if pipe: pipe.execute() def publishable_published(publishable, delta=0, **kwargs): pipe = None for lh in _get_listing_handlers(): if issubclass(lh, SlidingListingHandler): if delta != 0: pipe = lh.incr_score(publishable.category, publishable, incr_by=delta, pipe=pipe, commit=False) else: pipe = lh.add_publishable(publishable.category, publishable, pipe=pipe, commit=False) if pipe: pipe.execute() content_published.connect(publishable_published) content_unpublished.connect(publishable_unpublished) comment_was_posted.connect(comment_posted, sender=FlatComment) comment_was_moderated.connect(comment_moderated, sender=FlatComment)