Modify

Opened 3 years ago

Closed 3 years ago

#9046 closed defect (fixed)

ticket_created listener is called twice with creating a ticket via XML-RPC

Reported by: jun66j5 Owned by: osimons
Priority: normal Component: XmlRpcPlugin
Severity: normal Keywords:
Cc: olemis 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

     
    168168                    "non-current timestamp (%r)", req.authname, when) 
    169169            when = None 
    170170        t.insert(when=when) 
    171         # Call ticket change listeners 
    172         ts = TicketSystem(self.env) 
    173         for listener in ts.change_listeners: 
    174             listener.ticket_created(t) 
    175171        if notify: 
    176172            try: 
    177173                tn = TicketNotifyEmail(self.env) 
     
    250246                # Apply workflow side-effects 
    251247                for controller in controllers: 
    252248                    controller.apply_action_side_effects(req, t, action) 
    253                 # Call ticket change listeners 
    254                 for listener in ts.change_listeners: 
    255                     listener.ticket_changed(t, comment, author, t._old) 
    256249        if notify: 
    257250            try: 
    258251                tn = TicketNotifyEmail(self.env) 
     
    267260        t = model.Ticket(self.env, id) 
    268261        req.perm(t.resource).require('TICKET_ADMIN') 
    269262        t.delete() 
    270         ts = TicketSystem(self.env) 
    271         # Call ticket change listeners 
    272         for listener in ts.change_listeners: 
    273             listener.ticket_deleted(t) 
    274263 
    275264    def changeLog(self, req, id, when=0): 
    276265        t = model.Ticket(self.env, id) 

Attachments (0)

Change History (1)

comment:1 Changed 3 years ago by osimons

  • Resolution set to fixed
  • Status changed from new to closed

(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.

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.