Edgewall Software
Modify

Opened 15 years ago

Closed 15 years ago

#9171 closed defect (fixed)

IndexError: list index out of range

Reported by: Lele Gaifax <lele@…> Owned by: Christian Boos
Priority: normal Milestone: 0.12
Component: i18n Version: 0.12dev
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

Browsing random tickets on t.e.o. I get the following InternalError, which I suspect related to the i18n layer: on a particular ticket (#6353 to mention one), it always happens when using the italian locale, while fetching it with wget (and thus, in the native english language) it works without problems.

Traceback (most recent call last):
  File "build/bdist.linux-x86_64/egg/trac/web/main.py", line 514, in _dispatch_request
    dispatcher.dispatch(req)
  File "build/bdist.linux-x86_64/egg/trac/web/main.py", line 257, in dispatch
    content_type)
  File "build/bdist.linux-x86_64/egg/trac/web/chrome.py", line 862, 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 966, 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 955, 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 592, in _include
    for event in stream:
  File "build/bdist.linux-x86_64/egg/genshi/template/markup.py", line 381, in _match
    ctxt, start=idx + 1, **vars):
  File "build/bdist.linux-x86_64/egg/genshi/template/markup.py", line 381, in _match
    ctxt, start=idx + 1, **vars):
  File "build/bdist.linux-x86_64/egg/genshi/template/markup.py", line 381, in _match
    ctxt, start=idx + 1, **vars):
  File "build/bdist.linux-x86_64/egg/genshi/template/markup.py", line 330, in _match
    for event in stream:
  File "build/bdist.linux-x86_64/egg/genshi/template/base.py", line 532, 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 592, in _include
    for event in stream:
  File "build/bdist.linux-x86_64/egg/genshi/template/markup.py", line 330, in _match
    for event in stream:
  File "build/bdist.linux-x86_64/egg/genshi/template/markup.py", line 319, in _strip
    event = next()
  File "build/bdist.linux-x86_64/egg/genshi/template/base.py", line 532, 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 592, in _include
    for event in stream:
  File "build/bdist.linux-x86_64/egg/genshi/template/markup.py", line 319, in _strip
    event = next()
  File "build/bdist.linux-x86_64/egg/genshi/template/base.py", line 532, 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 592, in _include
    for event in stream:
  File "build/bdist.linux-x86_64/egg/genshi/template/markup.py", line 319, in _strip
    event = next()
  File "build/bdist.linux-x86_64/egg/genshi/template/base.py", line 532, in _flatten
    for kind, data, pos in stream:
  File "build/bdist.linux-x86_64/egg/genshi/filters/i18n.py", line 172, in _generate
    for event in msgbuf.translate(gettext(msgbuf.format())):
  File "build/bdist.linux-x86_64/egg/genshi/filters/i18n.py", line 1025, in translate
    parts = parse_msg(string)
  File "build/bdist.linux-x86_64/egg/genshi/filters/i18n.py", line 1138, in parse_msg
    parts.append((stack[-1], string))
IndexError: list index out of range

System info

Trac 0.12dev-r9391
Babel 0.9.4
Docutils 0.6
Genshi 0.6dev-r1096
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]
setuptools 0.6c9
Subversion 1.5.1 (r32289)

Attachments (0)

Change History (4)

comment:1 by Christian Boos, 15 years ago

Some more details:

File "build/bdist.linux-x86_64/egg/genshi/filters/i18n.py", riga 1025, in translate
Variabili locali:
Nome	Valore
regex	<_sre.SRE_Pattern object at 0x1332650>
self	<genshi.filters.i18n.MessageBuffer object at 0x4962810>
string	u'[1:%(file)s]\n      [2:[3]]\n       ([4:%(size)s]) -\n       aggiunto da ...

and:

File "build/bdist.linux-x86_64/egg/genshi/filters/i18n.py", riga 1138, in parse_msg
Variabili locali:
Nome	Valore
mo	<_sre.SRE_Match object at 0x5c08300>
orderno	None
parts	[(1, u'%(file)s'), (0, u'\n      '), (2, u'[3')]
regex	<_sre.SRE_Pattern object at 0x1313bd0>
stack	[]
string	u'\n       ([4:%(size)s]) -\n       aggiunto da [5:%(author)s] %(date)s ...

Original message seems coming from:

pos	(u'list_of_attachments.html', 18, 4)

i.e.

  • Template: source:trunk/trac/templates/list_of_attachments.html@9400#L18
  • Italian catalog:
    2151	#: trac/templates/list_of_attachments.html:18
    2152	#, python-format
    2153	msgid ""
    2154	"[1:%(file)s]\n"
    2155	"      [2:[3:]]\n"
    2156	"       ([4:%(size)s]) -\n"
    2157	"      added by [5:%(author)s] %(date)s ago."
    2158	msgstr ""
    2159	"[1:%(file)s]\n"
    2160	"      [2:[3]]\n"
    2161	"       ([4:%(size)s]) -\n"
    2162	"       aggiunto da [5:%(author)s] %(date)s fa."
    
  • French catalog:
    2209	#: trac/templates/list_of_attachments.html:18
    2210	#, python-format
    2211	msgid ""
    2212	"[1:%(file)s]\n"
    2213	"      [2:[3:]]\n"
    2214	"       ([4:%(size)s]) -\n"
    2215	"      added by [5:%(author)s] %(date)s ago."
    2216	msgstr ""
    2217	"[1:%(file)s]\n"
    2218	"      [2:[3:]]\n"
    2219	"      ([4:%(size)s]) -\n"
    2220	"      ajouté par [5:%(author)s] il y a %(date)s."
    

Can you spot the difference? [:]-)

comment:2 by Lele Gaifax <lele@…>, 15 years ago

Thank you a lot, please consider applying my latest patch on #5489, this bug forced me to switch to another language in the browser to be able to upload it, so I guess it should be pushed on t.e.o. ASAP.

comment:3 by Christian Boos, 15 years ago

Milestone: 0.12
Owner: set to Christian Boos

Patch committed in [9404] and server updated.

Now I leave the ticket open as a reminder to create a Genshi ticket for asking to improve the robustness of the i18n filter.

in reply to:  3 comment:4 by Christian Boos, 15 years ago

Resolution: fixed
Status: newclosed

Genshi ticket for asking to improve the robustness of the i18n filter.

See #G378.

Modify Ticket

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