Forwarding direct mail back to the mailing list.

-------- Forwarded Message --------
Subject:        Re: [Trac] Notify on any ticket changes
Date:   Tue, 13 Nov 2018 17:25:17 +0100
From:   Michal Seidl <[email protected]>
To:     Peter Suter <[email protected]>



Hello,
so may be I finally found the clue. I trigger NotifySystem event from
ITicketChangeListener. This is my single file plugin that trigers
TicketChangeEvent.

Hope can help someone. Michal

from trac.core import Component, implements
from trac.ticket.api import ITicketChangeListener
from trac.ticket.notification import TicketChangeEvent
from trac.notification.api import NotificationSystem
from trac.util.text import exception_to_unicode

class TicketAnyChangeListener(Component):
    implements(ITicketChangeListener)

    def ticket_created(self, ticket):
        pass

    def ticket_changed(self, ticket, comment, author, old_values):
        self.env.log.info("*** Ticket is %r ***", ticket)
        event = TicketChangeEvent('changed', ticket,
ticket.time_changed, author, comment)
        try:
            NotificationSystem(self.env).notify(event)
        except Exception as e:
            self.log.error("Failure sending notification ticket changed
#%s: %s",
                          ticket.id,exception_to_unicode(e))

    def ticket_deleted(self, ticket):
        pass

    def ticket_comment_modified(self, ticket, cdate, author, comment,
old_comment):
        pass

    def ticket_change_deleted(self, ticket, cdate, changes):
        pass


--
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to