Modify

Opened 16 years ago

Closed 16 years ago

#3082 closed defect (fixed)

'summary' feature doesn't work with 0.11b2 (at least) - AttributeError: 'NoneType' object has no attribute 'ticket'

Reported by: nicholas Owned by: Shun-ichi Goto
Priority: normal Component: TicketBoxMacro
Severity: normal Keywords:
Cc: Trac Release: 0.11

Description

I was getting this traceback:

2008-05-27 14:18:00,628 Trac[formatter] ERROR: Macro TicketBox({9},summary) failed
Traceback (most recent call last):
  File "c:\python25\lib\site-packages\Trac-0.11b2-py2.5.egg\trac\wiki\formatter.py", line 468, in _macro_formatter
    return macro.process(args, in_paragraph=True)
  File "c:\python25\lib\site-packages\Trac-0.11b2-py2.5.egg\trac\wiki\formatter.py", line 179, in process
    text = self.processor(text)
  File "c:\python25\lib\site-packages\Trac-0.11b2-py2.5.egg\trac\wiki\formatter.py", line 166, in _macro_processor
    text)
  File "e:\synergycmtrac\trac-project\plugins\TicketBox.py", line 170, in expand_macro
    return execute(formatter, args)
  File "e:\synergycmtrac\trac-project\plugins\TicketBox.py", line 138, in execute
    env, env.get_db_cnx()) for k,v in long_items.iteritems()], "<br>")
  File "c:\python25\lib\site-packages\Trac-0.11b2-py2.5.egg\trac\wiki\formatter.py", line 1123, in wiki_to_oneliner
    OneLinerFormatter(env, context).format(wikitext, out, shorten)
  File "c:\python25\lib\site-packages\Trac-0.11b2-py2.5.egg\trac\wiki\formatter.py", line 950, in format
    result = re.sub(self.wikiparser.rules, self.replace, result)
  File "C:\Python25\lib\re.py", line 142, in sub
    return _compile(pattern, 0).sub(repl, string, count)
  File "c:\python25\lib\site-packages\Trac-0.11b2-py2.5.egg\trac\wiki\formatter.py", line 804, in replace
    replacement = self.handle_match(fullmatch)
  File "c:\python25\lib\site-packages\Trac-0.11b2-py2.5.egg\trac\wiki\formatter.py", line 797, in handle_match
    return external_handler(self, match, fullmatch)
  File "c:\python25\lib\site-packages\Trac-0.11b2-py2.5.egg\trac\ticket\api.py", line 298, in <lambda>
    lambda x, y, z: self._format_link(x, 'ticket', y[1:], y, z))
  File "c:\python25\lib\site-packages\Trac-0.11b2-py2.5.egg\trac\ticket\api.py", line 319, in _format_link
    href = formatter.href.ticket(num) + params + fragment
AttributeError: 'NoneType' object has no attribute 'ticket'

and this patch seems to help:

  • TicketBox.py

    old new  
    134134    html = ''
    135135    if show_summary:
    136136        html = string.join([wiki_to_oneliner("%s (#%d)" % (v,k),
    137                                              env, env.get_db_cnx()) for k,v in long_items.iteritems()], "<br>")
     137                                             env,
     138                                             env.get_db_cnx(),
     139                                             req=formatter.req) for k,v in long_items.iteritems()], "<br>")
    138140    else:
    139141        html = wiki_to_oneliner(string.join(["#%d" % c for c in items], ", "),
    140142                                env, env.get_db_cnx(), req=formatter.req)

Attachments (0)

Change History (3)

comment:1 Changed 16 years ago by Shun-ichi Goto

Resolution: fixed
Status: newclosed

(In [3722]) Pass 'req' object in case of 'summary' option. Fix #3082. (thanks to nicholas).

comment:2 Changed 16 years ago by anonymous

Resolution: fixed
Status: closedreopened

comment:3 Changed 16 years ago by Shun-ichi Goto

Resolution: fixed
Status: reopenedclosed

I cannot reproduce this issue after r3722. Please write description you encounted if you want to reopen. So temporarily close this.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Shun-ichi Goto.
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.