Modify

Opened 8 years ago

Closed 8 years ago

#13103 closed defect (fixed)

Should pass as parameter rather than string interpolation for logging api

Reported by: Jun Omae Owned by: Eli Carter
Priority: normal Component: AdvancedTicketWorkflowPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.12

Description

For logging api, this plugin use string interpolation. I think we should pass as parameter like this:

  • advancedworkflow/controller.py

    diff --git a/advancedworkflow/controller.py b/advancedworkflow/controller.py
    index d8cac545b..766309105 100644
    a b class TicketWorkflowOpOwnerComponent(TicketWorkflowOpBase): 
    127127    def _new_owner(self, ticket):
    128128        """Determines the new owner"""
    129129        component = model.Component(self.env, name=ticket['component'])
    130         self.env.log.debug("component %s, owner %s" % (component, component.owner))
     130        self.log.debug("component %s, owner %s", component, component.owner)
    131131        return component.owner
    132132
    133133
    class TicketWorkflowOpRunExternal(TicketWorkflowOpBase): 
    318318                script += extension
    319319                break
    320320        else:
    321             self.env.log.error("Error in ticket workflow config; could not find external command to run for %s in %s" % (action, os
     321            self.log.error("Error in ticket workflow config; could not find "
     322                           "external command to run for %s in %s",
     323                           action, os.path.join(self.env.path, 'hooks'))
    322324            return
    323325        retval = call([script, str(ticket.id), req.authname])
    324326        if retval:
    325             self.env.log.error("External script %r exited with return code %s." % (script, retval))
     327            self.log.error("External script %r exited with return code %s.",
     328                           script, retval)
    326329
    327330
    328331class TicketWorkflowOpTriage(TicketWorkflowOpBase):
    class TicketWorkflowOpTriage(TicketWorkflowOpBase): 
    371374            if value == ticket[field].strip():
    372375                break
    373376        else:
    374             self.env.log.error("Bad configuration for 'triage' operation in action '%s'" % action)
     377            self.log.error("Bad configuration for 'triage' operation in "
     378                           "action '%s'", action)
    375379            status = 'new'
    376380        return status
    377381
    class TicketWorkflowOpXRef(TicketWorkflowOpBase): 
    467471            tn.notify(xticket, newticket=False, modtime=now)
    468472        except Exception, e:
    469473            self.log.exception("Failure sending notification on change to "
    470                                "ticket #%s: %s" % (ticketnum, e))
     474                               "ticket #%s: %s", ticketnum, e)
    471475
    472476
    473477class TicketWorkflowOpResetMilestone(TicketWorkflowOpBase):

Attachments (0)

Change History (2)

comment:1 Changed 8 years ago by Ryan J Ollos

This was already fixed for the 1.2 branch in r14247. Feel free to commit changes to the other branches if you like.

comment:2 Changed 8 years ago by Jun Omae

Resolution: fixed
Status: newclosed

In 16305:

AdvancedTicketWorkflowPlugin/0.12: pass as parameter rather than string interpolation for logging api (closes #13103)

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Eli Carter.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


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

 
Note: See TracTickets for help on using tickets.