Modify ↓
Opened 13 years ago
Closed 13 years ago
#9046 closed defect (fixed)
ticket_created listener is called twice with creating a ticket via XML-RPC
Reported by: | Jun Omae | Owned by: | osimons |
---|---|---|---|
Priority: | normal | Component: | XmlRpcPlugin |
Severity: | normal | Keywords: | |
Cc: | Olemis Lang | Trac Release: | 0.11 |
Description
The API ticket.create
has a problem. If the API is called, ticket_created
listener is called twice. Then ticket.update
and ticket.delete
have the similar problem.
The listeners is called in trac.ticket.model.Ticket
.
-
tracrpc/ticket.py
168 168 "non-current timestamp (%r)", req.authname, when) 169 169 when = None 170 170 t.insert(when=when) 171 # Call ticket change listeners172 ts = TicketSystem(self.env)173 for listener in ts.change_listeners:174 listener.ticket_created(t)175 171 if notify: 176 172 try: 177 173 tn = TicketNotifyEmail(self.env) … … 250 246 # Apply workflow side-effects 251 247 for controller in controllers: 252 248 controller.apply_action_side_effects(req, t, action) 253 # Call ticket change listeners254 for listener in ts.change_listeners:255 listener.ticket_changed(t, comment, author, t._old)256 249 if notify: 257 250 try: 258 251 tn = TicketNotifyEmail(self.env) … … 267 260 t = model.Ticket(self.env, id) 268 261 req.perm(t.resource).require('TICKET_ADMIN') 269 262 t.delete() 270 ts = TicketSystem(self.env)271 # Call ticket change listeners272 for listener in ts.change_listeners:273 listener.ticket_deleted(t)274 263 275 264 def changeLog(self, req, id, when=0): 276 265 t = model.Ticket(self.env, id)
Attachments (0)
Note: See
TracTickets for help on using
tickets.
(In [10514]) XmlRpcPlugin: Ticket listeners was called twice, and seeing they are already called in
ticket.model.Ticket
they should not be called in RPC code.Report & patch by Jun Omae. Closes #9046.