doc/book/en/devrepo/repo/notifications.rst
author Sylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 25 Apr 2013 16:10:56 +0200
changeset 8928 f5b40b66d36e
parent 5394 105011657405
permissions -rw-r--r--
[notification] introduce an official `notify_on_commit` function It provides a proper notification api instead of replacing it by yet another clumsy one. Closes #2837251
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
     1
.. -*- coding: utf-8 -*-
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
     2
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
     3
Notifications management
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
     4
========================
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents:
diff changeset
     5
8928
f5b40b66d36e [notification] introduce an official `notify_on_commit` function
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5394
diff changeset
     6
CubicWeb provides a machinery to ease notifications handling. To use it for a
f5b40b66d36e [notification] introduce an official `notify_on_commit` function
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5394
diff changeset
     7
notification:
f5b40b66d36e [notification] introduce an official `notify_on_commit` function
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5394
diff changeset
     8
f5b40b66d36e [notification] introduce an official `notify_on_commit` function
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5394
diff changeset
     9
* write a view inheriting from
f5b40b66d36e [notification] introduce an official `notify_on_commit` function
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5394
diff changeset
    10
  :class:`~cubicweb.sobjects.notification.NotificationView`.  The usual view api
f5b40b66d36e [notification] introduce an official `notify_on_commit` function
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5394
diff changeset
    11
  is used to generated the email (plain text) content, and additional
f5b40b66d36e [notification] introduce an official `notify_on_commit` function
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5394
diff changeset
    12
  :meth:`~cubicweb.sobjects.notification.NotificationView.subject` and
f5b40b66d36e [notification] introduce an official `notify_on_commit` function
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5394
diff changeset
    13
  :meth:`~cubicweb.sobjects.notification.NotificationView.recipients` methods
f5b40b66d36e [notification] introduce an official `notify_on_commit` function
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5394
diff changeset
    14
  are used to build the email's subject and
f5b40b66d36e [notification] introduce an official `notify_on_commit` function
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5394
diff changeset
    15
  recipients. :class:`NotificationView` provides default implementation for both
f5b40b66d36e [notification] introduce an official `notify_on_commit` function
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5394
diff changeset
    16
  methods.
f5b40b66d36e [notification] introduce an official `notify_on_commit` function
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5394
diff changeset
    17
f5b40b66d36e [notification] introduce an official `notify_on_commit` function
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5394
diff changeset
    18
* write a hook for event that should trigger this notification, select the view
f5b40b66d36e [notification] introduce an official `notify_on_commit` function
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5394
diff changeset
    19
  (without rendering it), and give it to
f5b40b66d36e [notification] introduce an official `notify_on_commit` function
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5394
diff changeset
    20
  :func:`cubicweb.hooks.notification.notify_on_commit` so that the notification
f5b40b66d36e [notification] introduce an official `notify_on_commit` function
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5394
diff changeset
    21
  will be sent if the transaction succeed.
f5b40b66d36e [notification] introduce an official `notify_on_commit` function
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5394
diff changeset
    22
f5b40b66d36e [notification] introduce an official `notify_on_commit` function
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5394
diff changeset
    23
f5b40b66d36e [notification] introduce an official `notify_on_commit` function
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5394
diff changeset
    24
.. XXX explain recipient finder and provide example
f5b40b66d36e [notification] introduce an official `notify_on_commit` function
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5394
diff changeset
    25
f5b40b66d36e [notification] introduce an official `notify_on_commit` function
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5394
diff changeset
    26
API details
f5b40b66d36e [notification] introduce an official `notify_on_commit` function
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5394
diff changeset
    27
~~~~~~~~~~~
f5b40b66d36e [notification] introduce an official `notify_on_commit` function
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5394
diff changeset
    28
.. autoclass:: cubicweb.sobjects.notification.NotificationView
f5b40b66d36e [notification] introduce an official `notify_on_commit` function
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5394
diff changeset
    29
.. autofunction:: cubicweb.hooks.notification.notify_on_commit