The Trac web application sends out emails perfectly. I even configured the Trac Html Notification plugin and that works too.
I want to use the API to update tickets and have them send out the notification as well and it is not working. I am doing something like this
JavaScript
x
10
10
1
from trac.core import *
2
from trac.env import Environment
3
from trac.ticket.model import Ticket
4
5
env = Environment('E:Trac/project')
6
7
tkt = Ticket(env, 383)
8
tkt['status'] = 'assigned'
9
tkt.save_changes()
10
Or
JavaScript
1
19
19
1
from trac.core import *
2
from trac.env import Environment
3
from trac.ticket.model import Ticket
4
5
env = Environment('E:Trac/project')
6
7
summary = "Test New Ticket"
8
description = 'Testing new ticket'
9
10
tkt = Ticket(env)
11
tkt['reporter'] = 'jorozco'
12
tkt['owner'] = 'jorozco'
13
tkt['summary'] = summary
14
tkt['description'] = description
15
tkt['priority'] = 'Top'
16
tkt['task'] = '33'
17
tkt['status'] = 'new'
18
tkt.insert()
19
I am using Trac version 1.5.1 on Windows.
Thanks,
Joe
Advertisement
Answer
Notifications aren’t sent by changing a Ticket
model object. Rather, you have to create a TicketChangeEvent
and pass it to NotificationSystem.notify
. See here.
In the future we may try to implement notification through ITicketChangeListener
so that it’s invoked on changes to a ticket object, but it requires some redesign. See #13029.