author | Denis Laxalde <denis.laxalde@logilab.fr> |
Tue, 12 Sep 2017 15:05:22 +0200 | |
changeset 12208 | 159dce89a145 |
parent 10491 | c67bcee93248 |
permissions | -rw-r--r-- |
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 |