Edgewall Software
Modify

Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#9267 closed defect (fixed)

IndexError: no such group

Reported by: Mikael Relbe Owned by: Remy Blank
Priority: normal Milestone: 0.12
Component: wiki system Version: 0.12dev
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

While #9239 was fixed in [9541] and t.e.o. was upgraded to use r9547, ticket #9239 fails to be rendered…

The following is generated on t.e.o. r9547:

How to Reproduce

While doing a GET operation on /ticket/9239, Trac issued an internal error.

(please provide additional details here)

Request parameters:

{'id': u'9239'}

User Agent was: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 (.NET CLR 3.5.30729)

System Information

Trac 0.12dev-r9547
Babel 0.9.4
Docutils 0.6
Genshi 0.6
psycopg2 2.0.8
Pygments 1.2.2dev-20100224
Python 2.5.2 (r252:60911, Oct 5 2008, 19:29:17)
[GCC 4.3.2]
pytz 2010g
setuptools 0.6c9
Subversion 1.5.1 (r32289)
jQuery 1.4.2

Enabled Plugins

Python Traceback

Traceback (most recent call last):
  File "build/bdist.linux-x86_64/egg/trac/web/main.py", line 512, in _dispatch_request
    dispatcher.dispatch(req)
  File "build/bdist.linux-x86_64/egg/trac/web/main.py", line 255, in dispatch
    content_type)
  File "build/bdist.linux-x86_64/egg/trac/web/chrome.py", line 864, in render_template
    stream.render(method, doctype=doctype, out=buffer)
  File "build/bdist.linux-x86_64/egg/genshi/core.py", line 183, in render
    return encode(generator, method=method, encoding=encoding, out=out)
  File "build/bdist.linux-x86_64/egg/genshi/output.py", line 58, in encode
    for chunk in iterator:
  File "build/bdist.linux-x86_64/egg/genshi/output.py", line 339, in __call__
    for kind, data, pos in stream:
  File "build/bdist.linux-x86_64/egg/genshi/output.py", line 826, in __call__
    for kind, data, pos in stream:
  File "build/bdist.linux-x86_64/egg/genshi/output.py", line 670, in __call__
    for kind, data, pos in stream:
  File "build/bdist.linux-x86_64/egg/genshi/output.py", line 771, in __call__
    for kind, data, pos in chain(stream, [(None, None, None)]):
  File "build/bdist.linux-x86_64/egg/genshi/output.py", line 586, in __call__
    for ev in stream:
  File "build/bdist.linux-x86_64/egg/genshi/core.py", line 288, in _ensure
    for event in stream:
  File "build/bdist.linux-x86_64/egg/genshi/core.py", line 288, in _ensure
    for event in stream:
  File "build/bdist.linux-x86_64/egg/trac/web/chrome.py", line 968, in _strip_accesskeys
    for kind, data, pos in stream:
  File "build/bdist.linux-x86_64/egg/genshi/core.py", line 288, in _ensure
    for event in stream:
  File "build/bdist.linux-x86_64/egg/trac/web/chrome.py", line 957, in _generate
    for kind, data, pos in stream:
  File "build/bdist.linux-x86_64/egg/genshi/core.py", line 288, in _ensure
    for event in stream:
  File "build/bdist.linux-x86_64/egg/genshi/template/base.py", line 605, in _include
    for event in stream:
  File "build/bdist.linux-x86_64/egg/genshi/template/markup.py", line 378, in _match
    ctxt, start=idx + 1, **vars):
  File "build/bdist.linux-x86_64/egg/genshi/template/markup.py", line 378, in _match
    ctxt, start=idx + 1, **vars):
  File "build/bdist.linux-x86_64/egg/genshi/template/markup.py", line 378, in _match
    ctxt, start=idx + 1, **vars):
  File "build/bdist.linux-x86_64/egg/genshi/template/markup.py", line 327, in _match
    for event in stream:
  File "build/bdist.linux-x86_64/egg/genshi/template/base.py", line 545, in _flatten
    for kind, data, pos in stream:
  File "build/bdist.linux-x86_64/egg/genshi/core.py", line 288, in _ensure
    for event in stream:
  File "build/bdist.linux-x86_64/egg/genshi/path.py", line 588, in _generate
    subevent = next()
  File "build/bdist.linux-x86_64/egg/genshi/template/base.py", line 605, in _include
    for event in stream:
  File "build/bdist.linux-x86_64/egg/genshi/template/markup.py", line 327, in _match
    for event in stream:
  File "build/bdist.linux-x86_64/egg/genshi/template/markup.py", line 316, in _strip
    event = next()
  File "build/bdist.linux-x86_64/egg/genshi/template/base.py", line 545, in _flatten
    for kind, data, pos in stream:
  File "build/bdist.linux-x86_64/egg/genshi/core.py", line 288, in _ensure
    for event in stream:
  File "build/bdist.linux-x86_64/egg/genshi/path.py", line 588, in _generate
    subevent = next()
  File "build/bdist.linux-x86_64/egg/genshi/template/base.py", line 605, in _include
    for event in stream:
  File "build/bdist.linux-x86_64/egg/genshi/template/markup.py", line 316, in _strip
    event = next()
  File "build/bdist.linux-x86_64/egg/genshi/template/base.py", line 545, in _flatten
    for kind, data, pos in stream:
  File "build/bdist.linux-x86_64/egg/genshi/core.py", line 288, in _ensure
    for event in stream:
  File "build/bdist.linux-x86_64/egg/genshi/path.py", line 588, in _generate
    subevent = next()
  File "build/bdist.linux-x86_64/egg/genshi/template/base.py", line 605, in _include
    for event in stream:
  File "build/bdist.linux-x86_64/egg/genshi/template/markup.py", line 316, in _strip
    event = next()
  File "build/bdist.linux-x86_64/egg/genshi/template/base.py", line 565, in _flatten
    result = _eval_expr(data, ctxt, vars)
  File "build/bdist.linux-x86_64/egg/genshi/template/base.py", line 277, in _eval_expr
    retval = expr.evaluate(ctxt)
  File "build/bdist.linux-x86_64/egg/genshi/template/eval.py", line 178, in evaluate
    return eval(self.code, _globals, {'__data__': data})
  File "/tmp/.lighttpd-egg-cache-trunk/Trac-0.12dev_r9547-py2.5.egg-tmp/trac/ticket/templates/ticket_change.html", line 61, in <Expression u'wiki_to_html(context, change.comment, escape_newlines=preserve_newlines)'>
    <py:otherwise>${wiki_to_html(context, change.comment, escape_newlines=preserve_newlines)}</py:otherwise>
  File "build/bdist.linux-x86_64/egg/trac/wiki/formatter.py", line 1497, in format_to_html
    return HtmlFormatter(env, context, wikidom).generate(escape_newlines)
  File "build/bdist.linux-x86_64/egg/trac/wiki/formatter.py", line 1452, in generate
    escape_newlines)
  File "build/bdist.linux-x86_64/egg/trac/wiki/formatter.py", line 1233, in format
    result = re.sub(self.wikiparser.rules, self.replace, line)
  File "/usr/lib/python2.5/re.py", line 150, in sub
    return _compile(pattern, 0).sub(repl, string, count)
  File "build/bdist.linux-x86_64/egg/trac/wiki/formatter.py", line 1156, in replace
    replacement = self.handle_match(fullmatch)
  File "build/bdist.linux-x86_64/egg/trac/wiki/formatter.py", line 1152, in handle_match
    return internal_handler(match, fullmatch)
  File "build/bdist.linux-x86_64/egg/trac/wiki/formatter.py", line 704, in _macrolink_formatter
    return self._lhref_formatter(match, fullmatch)
  File "build/bdist.linux-x86_64/egg/trac/wiki/formatter.py", line 535, in _lhref_formatter
    return self._make_lhref_link(match, fullmatch, rel, ns, target, label)
  File "build/bdist.linux-x86_64/egg/trac/wiki/formatter.py", line 570, in _make_lhref_link
    label, fullmatch)
  File "build/bdist.linux-x86_64/egg/trac/wiki/formatter.py", line 585, in _make_link
    fullmatch)
  File "build/bdist.linux-x86_64/egg/trac/ticket/api.py", line 435, in _format_link
    fullmatch)
  File "build/bdist.linux-x86_64/egg/trac/wiki/formatter.py", line 638, in shorthand_intertrac_helper
    it_group = fullmatch.group('it_%s' % ns)
IndexError: no such group

Attachments (0)

Change History (6)

comment:1 by Remy Blank, 14 years ago

Component: generalwiki system
Milestone: 0.12
Owner: set to Remy Blank

I know where this comes from. Fix coming shortly.

comment:2 by Christian Boos, 14 years ago

Argh, fix already there ;-)

Right, before r9541, _format_link was only expecting the regexp for #T123 (the it_ticket group gets the InterTrac key T).

We should simply ignore such errors.

  • trac/wiki/formatter.py

    diff --git a/trac/wiki/formatter.py b/trac/wiki/formatter.py
    a b class Formatter(object):  
    634634            return None
    635635
    636636    def shorthand_intertrac_helper(self, ns, target, label, fullmatch):
    637         if fullmatch: # short form
    638             it_group = fullmatch.group('it_%s' % ns)
     637        name = 'it_' + ns
     638        if fullmatch and name in fullmatch.groupdict(): # short form
     639            it_group = fullmatch.group(name)
    639640            if it_group:
    640641                alias = it_group.strip()
    641642                intertrac = self.env.config['intertrac']
    642643                target = '%s:%s' % (ns, target[len(it_group):])
    643644                return self._make_intertrac_link(intertrac.get(alias, alias),
    644645                                                 target, label) or label
    645         return None
    646646
    647647    def _make_interwiki_link(self, ns, target, label):
    648648        from trac.wiki.interwiki import InterWikiMap

comment:3 by Remy Blank, 14 years ago

A similar fix is needed in the wiki.

comment:4 by Remy Blank, 14 years ago

Resolution: fixed
Status: newclosed

Complete fix (hopefully) committed in [9549].

comment:5 by Mikael Relbe, 14 years ago

[9549] tested locally on my own server, and looks good. I propose you update t.e.o. in a hurry since, for example, TracLinks is not readable right now…

comment:6 by Christian Boos, 14 years ago

Done. We should probably also add a few unit-tests for this…

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Remy Blank.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Remy Blank 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.