Exemplo n.º 1
0
def fanout(operation, activity, recipients, feed):
    """
    Fanout is called in celery task and is responsible for distributing the actions into the
    destination feeds.
    """
    activity = Activity.deserialize(activity)
    feed = apps.get_model("feeds", feed)

    if operation == ADD:
        return add_to_feed(activity, feed, recipients)

    elif operation == REMOVE:
        return remove_from_feed(activity, feed, recipients)

    raise ValueError("Invalid feed operation")
Exemplo n.º 2
0
 def activities(self):
     return [
         Activity.deserialize(activity) for activity in self.activity_store
     ]