#3517 closed enhancement (fixed)
Notification plugin
Reported by: | Owned by: | Peter Suter | |
---|---|---|---|
Priority: | normal | Milestone: | 1.1.3 |
Component: | notification | Version: | 0.9.6 |
Severity: | major | Keywords: | |
Cc: | ufs@…, davidf@…, pacopablo@…, Jun Omae | Branch: | |
Release Notes: |
Allow plugins to extend notification system. |
||
API Changes: |
Added new API for notification distribution and extension points:
|
||
Internal Changes: |
Description
Currently trac only supports email notifications. For some environments it it would be very practical to use different kinds of notifications; for example to send a SMS when tickets of a specific type are files, or to notify CIA of new tickets.
It seems sensible to create an extension point for the notification infrastructure so one or more plugins can handle notifications.
Attachments (3)
Change History (29)
by , 18 years ago
Attachment: | trac-cia.diff added |
---|
comment:1 by , 18 years ago
I've added a patch which implements a trac-CIA connection. This implementation is quite bad since it hooks trac directly into the email notifier logic, but the xmlrpc code can easily be reused.
comment:2 by , 18 years ago
Component: | ticket system → notification |
---|---|
Milestone: | → 0.12 |
Owner: | changed from | to
Severity: | normal → major |
Yes, a more generic infrastructure for notifications will be a big topic for 0.12.
comment:3 by , 17 years ago
Cc: | added |
---|
comment:4 by , 17 years ago
I'd really appreciate if someone could manage to update this patch to work with 0.10.4 - my python skills are sadly lacking!
comment:5 by , 17 years ago
I did an improved version of that patch for 0.10 a while ago. I'll add it to this issue.
follow-up: 8 comment:6 by , 17 years ago
Cc: | added |
---|
Also wanting to add a generic jabber notification system…. again this would make sense as a plugin
comment:7 by , 16 years ago
We definitely need a few explanations about how to make it work. I've patched my trac, figured a few config items from code, but i can't make it work. Can someone please post instructions and a config sample? Thanks in advance.
comment:8 by , 16 years ago
Replying to davidf@sjsoft.com:
Also wanting to add a generic jabber notification system…. again this would make sense as a plugin
BTW, for Mac users only: I've written a growl notification plugin.
comment:9 by , 16 years ago
For reference this is the configuration we use for Plone:
[notification] always_notify_owner = true always_notify_reporter = true cia_enabled = true cia_project = Plone cia_server = http://cia.navi.cx smtp_always_cc = plone-collector@objectrealms.net smtp_enabled = true smtp_from = discard@antiloop.plone.org smtp_password = smtp_port = 25 smtp_replyto = discard@antiloop.plone.org smtp_server = localhost smtp_user =
comment:10 by , 16 years ago
Cc: | added |
---|
follow-up: 15 comment:11 by , 11 years ago
The INotificationDistributor extension point of the AdvancedNotification proposal provides a clean way for plugins to implement such alternative notification protocols.
The proposed changes can be found in log:psuter@advanced-notification-mail-distribution.
Several other new extension points and public APIs for plugins are also introduced there. These might have to be reviewed and discussed in some more detail. For example I listed some open questions in the relevant wiki pages (e.g. NotificationEvent API, INotificationFormatter and IEmailAddressResolver).
comment:12 by , 11 years ago
Milestone: | next-major-releases → 1.1.2 |
---|---|
Owner: | changed from | to
Status: | new → assigned |
comment:13 by , 11 years ago
Cc: | added |
---|
comment:14 by , 11 years ago
Milestone: | 1.1.2 → 1.1.3 |
---|
comment:15 by , 10 years ago
The proposed changes can be found in log:psuter@advanced-notification-mail-distribution.
Updated in log:psuter@advanced-notification-mail-distribution.2.
These might have to be reviewed and discussed in some more detail. For example I listed some open questions in the relevant wiki pages (e.g. NotificationEvent API, INotificationFormatter and IEmailAddressResolver).
I'll probably just commit the current state. We can still fine-tune later if problems emerge.
follow-up: 19 comment:16 by , 10 years ago
Committed to trunk in [13454]. I'll follow up with changes for milestone delete and retargeting events:
-
trac/ticket/roadmap.py
diff -r c5cadf7e6beb trac/ticket/roadmap.py
a b 35 35 from trac.util.text import CRLF, exception_to_unicode, to_unicode 36 36 from trac.util.translation import _, tag_ 37 37 from trac.ticket.api import TicketSystem 38 from trac.ticket.notification import BatchTicketNotifyEmail38 from trac.ticket.notification import send_ticket_event, BatchTicketChangeEvent 39 39 from trac.ticket.model import Milestone, MilestoneCache, Ticket, \ 40 40 group_milestones 41 41 from trac.timeline.api import ITimelineEventProvider … … 775 775 new_values = {'milestone': retarget_to} 776 776 comment = comment or \ 777 777 _("Open tickets retargeted after milestone closed") 778 tn = BatchTicketNotifyEmail(self.env) 778 event = BatchTicketChangeEvent(retargeted_tickets, None, 779 req.authname, comment, 780 new_values, None) 779 781 try: 780 tn.notify(retargeted_tickets, new_values, comment, None, 781 req.authname) 782 send_ticket_event(self.env, self.config, event) 782 783 except Exception as e: 783 784 self.log.error("Failure sending notification on ticket " 784 785 "batch change: %s", … … 827 828 retarget=retarget_to)) 828 829 new_values = {'milestone': retarget_to} 829 830 comment = _("Tickets retargeted after milestone deleted") 830 tn = BatchTicketNotifyEmail(self.env) 831 event = BatchTicketChangeEvent(retargeted_tickets, None, 832 req.authname, comment, new_values, 833 None) 831 834 try: 832 tn.notify(retargeted_tickets, new_values, comment, None, 833 req.authname) 835 send_ticket_event(self.env, self.config, event) 834 836 except Exception as e: 835 837 self.log.error("Failure sending notification on ticket batch " 836 838 "change: %s", exception_to_unicode(e))
follow-up: 18 comment:17 by , 10 years ago
Moved draft documentation to:
- TracDev/NotificationApi (Replacing an large table and list of plugins etc. Should that information be kept somewhere?)
- TracDev/PluginDevelopment/ExtensionPoints/trac.notification.api.INotificationDistributor
- TracDev/PluginDevelopment/ExtensionPoints/trac.notification.api.INotificationFormatter
- TracDev/PluginDevelopment/ExtensionPoints/trac.notification.api.IEmailAddressResolver
- TracDev/PluginDevelopment/ExtensionPoints/trac.notification.api.IEmailDecorator
comment:18 by , 10 years ago
Replying to psuter:
(Replacing an large table and list of plugins etc. Should that information be kept somewhere?)
I would just add a link somewhere on the page stating that the pre-1.1.3 Trac Notification API is documented at TracDev/NotificationApi@3.
comment:19 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
I'll follow up with changes for milestone delete and retargeting events:
Committed in [13458].
Replying to rjollos:
I would just add a link somewhere on the page stating that the pre-1.1.3 Trac Notification API is documented at TracDev/NotificationApi@3.
Thanks, done.
follow-up: 21 comment:20 by , 9 years ago
TicketNotifyEmail
and BatchTicketNotifyEmail
are marked as deprecated ([13578]), but methods of the classes are called in TicketFormatter
. Is the plan to move those methods to the TicketFormatter
class when TicketNotifyEmail
and BatchTicketNotifyEmail
are removed?
comment:21 by , 9 years ago
Replying to rjollos:
TicketNotifyEmail
andBatchTicketNotifyEmail
are marked as deprecated ([13578]), but methods of the classes are called inTicketFormatter
. Is the plan to move those methods to theTicketFormatter
class whenTicketNotifyEmail
andBatchTicketNotifyEmail
are removed?
I think that's exactly what should be done, yes. (The formatting logic of those classes is perfectly fine. The problem with them was the coupling of formatting, sending and recipients gathering, with missing hooks for effective customization. Perhaps more subjectively that inheritance chain has a bit of a Yo-yo problem.)
comment:22 by , 9 years ago
Thanks, I'll proposed the changes in #11901, to be applied in milestone:1.3.1.
comment:23 by , 8 years ago
I noticed that DEBUG level logging provides no log messages to indicate that trac.ticket.notification
is loading.
19:13:45 Trac[loader] DEBUG: Loading trac.ticket.admin from /Users/rjollos/Documents/Workspace/trac-dev/teo-rjollos.git 19:13:45 Trac[loader] DEBUG: Loading trac.ticket.batch from /Users/rjollos/Documents/Workspace/trac-dev/teo-rjollos.git 19:13:45 Trac[loader] DEBUG: Loading trac.ticket.query from /Users/rjollos/Documents/Workspace/trac-dev/teo-rjollos.git 19:13:45 Trac[loader] DEBUG: Loading trac.ticket.report from /Users/rjollos/Documents/Workspace/trac-dev/teo-rjollos.git 19:13:45 Trac[loader] DEBUG: Loading trac.ticket.roadmap from /Users/rjollos/Documents/Workspace/trac-dev/teo-rjollos.git 19:13:45 Trac[loader] DEBUG: Loading trac.ticket.web_ui from /Users/rjollos/Documents/Workspace/trac-dev/teo-rjollos.git
Would the following be advisable?
-
setup.py
diff --git a/setup.py b/setup.py index 0a51fa22a..1d21222ce 100755
a b facilities. 137 137 trac.ticket.admin = trac.ticket.admin 138 138 trac.ticket.batch = trac.ticket.batch 139 139 trac.ticket.query = trac.ticket.query 140 trac.ticket.notification = trac.ticket.notification 140 141 trac.ticket.report = trac.ticket.report 141 142 trac.ticket.roadmap = trac.ticket.roadmap 142 143 trac.ticket.web_ui = trac.ticket.web_ui
19:13:45 Trac[loader] DEBUG: Loading trac.ticket.notification from /Users/rjollos/Documents/Workspace/trac-dev/teo-rjollos.git
In the ticket
package the api
and default_workflow
are also excluded from entry_points
, even though they have Components
. I'm unsure what determines that a module should be listed in entry_points
of the setup
function.
comment:24 by , 8 years ago
A few of the interfaces in tags/trac-1.2/trac/notification/api.py#L34 have the self
parameter. Adding self
has been discussed in the past, but other interfaces in Trac and even some in trac/notification/api.py
do not have self
. Should I just remove them?
comment:25 by , 8 years ago
comment:24 changes committed to 1.2-stable in r15314, merged to trunk in r15315.
Example of submitting messages to CIA from trac