Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Generic framework for tracking subscriptions to things and emitting notices to subscribed users
branch: master

Merge pull request #15 from ivaggione/master

Support for non-cluster messages
latest commit f4eb338d5e
@yeago authored
Failed to load latest commit information.
subscription Support for non-cluster messages update reedmeh pass this in

Adopted Spec Format


Subscription.objects.subscribe(user,content_object) # Subscribes a user


Subscription.objects.emit("comment.create", comment_spec,

Subscription.objects.emit("comment.create", comment_obj,
    subscribers_of=comment_obj.content_object, emitter_class=ModelEmitter)

The args/kwargs to emit() are more or less shuttled straight to the SUBSCRIPTION_BACKEND(s), which is a dict in your like:

  'email': 'myproject.subscription_backends.Email',
  'redis': 'myproject.subscription_backends.Redis',

Writing a backend

You can subclass subscription.backends.BaseBackend. Right now the options are:

  • instance
  • verb
  • activity stream spec attrs (published, target, object, actor)
  • subscribers_of - Gets the recipients from the Subscription model
  • dont_send_to - Useful for supressing comment messages to their own author, for example
  • send_only_to - Useful for other things I guess
  • **kwargs - Passed onto your backend subclass in case you need more info
Something went wrong with that request. Please try again.