Edgewall Software
Modify

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#12184 closed defect (fixed)

CommitTicketReference macro with no arguments crashes

Reported by: Jun Omae Owned by: Jun Omae
Priority: normal Milestone: 1.0.10
Component: ticket system Version: 0.12
Severity: minor Keywords:
Cc: Branch:
Release Notes:

CommitTicketUpdater no longer raises an AttributeError when invoked as a macro.

API Changes:
Internal Changes:

Description

When [[CommitTicketReference]] is invoked as wiki macro, it leads AttributeError.

2015-08-26 14:45:24,833 Trac[formatter] DEBUG: Executing Wiki macro CommitTicketReference by provider <tracopt.ticket.commit_updater
.CommitTicketReferenceMacro object at 0x7f255426ead0>
2015-08-26 14:45:24,860 Trac[formatter] ERROR: Macro CommitTicketReference(None) failed:
Traceback (most recent call last):
  File "/venv/trac/1.0.8/lib/python2.5/site-packages/trac/wiki/formatter.py", line 789, in _macro_formatter
    return macro.ensure_inline(macro.process(args))
  File "/venv/trac/1.0.8/lib/python2.5/site-packages/trac/wiki/formatter.py", line 358, in process
    text = self.processor(text)
  File "/venv/trac/1.0.8/lib/python2.5/site-packages/trac/wiki/formatter.py", line 342, in _macro_processor
    text, self.args)
  File "/venv/trac/1.0.8/lib/python2.5/site-packages/tracopt/ticket/commit_updater.py", line 301, in expand_macro
    reponame = args.get('repository') or ''
AttributeError: 'NoneType' object has no attribute 'get'
  • tracopt/ticket/commit_updater.py

    diff --git a/tracopt/ticket/commit_updater.py b/tracopt/ticket/commit_updater.py
    index ec11a1b7b..b20732488 100644
    a b class CommitTicketReferenceMacro(WikiMacroBase):  
    297297     - `revision`: the revision of the desired changeset
    298298    """)
    299299
    300     def expand_macro(self, formatter, name, content, args={}):
     300    def expand_macro(self, formatter, name, content, args=None):
     301        args = args or {}
    301302        reponame = args.get('repository') or ''
    302303        rev = args.get('revision')
    303304        repos = RepositoryManager(self.env).get_repository(reponame)

Attachments (0)

Change History (5)

comment:1 by Ryan J Ollos, 5 years ago

Milestone: 1.0.91.0.10

Moving tickets that appear to be uncompleted for milestone:1.0.9. Please move back to milestone:1.0.9 if the ticket can be completed by 2015-09-07 18:00 UTC.

comment:2 by Ryan J Ollos, 5 years ago

Owner: set to Ryan J Ollos
Status: newassigned

I'll add a test and commit the change.

comment:3 by Ryan J Ollos, 5 years ago

Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

Committed to 1.0-stable in [14449], merged to trunk in [14450].

comment:4 by Ryan J Ollos, 5 years ago

Owner: changed from Ryan J Ollos to Jun Omae

comment:5 by Ryan J Ollos, 5 years ago

Release Notes: modified (diff)

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jun Omae.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Jun Omae to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.