trac.notification NotifyEmail replacement in plugin development
50 views
Skip to first unread message
Brian
unread,
Jun 18, 2017, 7:21:36 PM6/18/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Trac Development
How can I send "user defined" emails with the "new" trac.notification system? Or where can I find an example of a way to use the "new" api.
I'm trying to migrate some plugins to Trac 1.3.2 (trunk) and stumble upon the removed trac.notification NotfyEmail implementation that is deprecated for a while now.
I have searched the trac api web pages and the trac development pages where the new api is basically described. But for now I have still no idea of how I could implement a substitution for the NotifyEmail.notify() or NotifyEmail.send() functions to just send email notifications. This feature is uses in many plugins and support for those plugins will break with Trac 1.3.x (as an important example: the AccountManager plugin).
I would like to upgrade at least our own installations of those plugins if some of you might be able to lead me in the right direction.
Cheers, Brian
Peter Suter
unread,
Jun 19, 2017, 1:37:53 AM6/19/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to trac...@googlegroups.com
On 19.06.2017 00:50, 'Brian' via Trac Development wrote:
> How can I send "user defined" emails with the "new" trac.notification
> system? Or where can I find an example of a way to use the "new" api.
>
> I'm trying to migrate some plugins to Trac 1.3.2 (trunk) and stumble
> upon the removed trac.notification NotfyEmail implementation that is
> deprecated for a while now.
>
> I have searched the trac api web pages and the trac development pages
> where the new api is basically described. But for now I have still no
> idea of how I could implement a substitution for the
> NotifyEmail.notify() or NotifyEmail.send() functions to just send email
> notifications. This feature is uses in many plugins and support for
> those plugins will break with Trac 1.3.x (as an important example: the
> AccountManager
> plugin).
>
> I would like to upgrade at least our own installations of those plugins
> if some of you might be able to lead me in the right direction.
>
> Cheers,
> Brian
Depending on the plugin you might need the following:
1. Create a new subclass of NotificationEvent, or find an existing
subclass like TicketChangeEvent that contains the information you need.
(Or call NotificationSystem.distribute_event() to circumvent
subscribers, but this is not the preferred way. If possible just add
more subscribers as needed.
3. If you created a new NotificationEvent class, you also need to create
a new INotificationFormatter component implementation that formats such
events to emails.
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Trac Development
Hello Peter,
thank your for your fast reply. Your explanation and examples should help me getting started. :) I was not aware that there is already a ticked for the new notification system for the AccountManager on TracHacks, so thank you for leading me to this ticked as well. So I will try to migrate the Notification system of the AccountManager as a starting point for other plugins we are depending on and post my progress in the ticket (and probably as well here).
I personally really love Trac in many ways and I want to use the opportunity to thank you guys for all your great work! :)