doc/book/devrepo/repo/notifications.rst
author Christophe de Vienne <christophe@unlish.com>
Thu, 08 Jan 2015 22:11:06 +0100
changeset 10491 c67bcee93248
parent 8928 doc/book/en/devrepo/repo/notifications.rst@f5b40b66d36e
permissions -rw-r--r--
[doc] Restructure the documentation * Create a new index file * Move the sphinx configuration files do the documentation root * Move book/README to dev/documenting.rst * Move book/mode_plan.py to tools/ * Move book/en/images to images * Move book/en/* to book/ * Move changelogs to changes/* * Adapt the Makefile * Add a title to the javascript api index Related to #4832808
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