Example #1
0
    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)
Example #2
0
 def setUp(self):
     super(TestForm, self).setUp()
     comment_was_posted.connect(self._comment_posted)
     self._posted = []
Example #3
0
                                     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)