#566 closed defect (fixed)
IndexError: pop from empty list with i18n:msg on Genshi 0.6.1
Reported by: | jomae | Owned by: | hodgestar |
---|---|---|---|
Priority: | major | Milestone: | 0.6.2 |
Component: | Template processing | Version: | 0.6 |
Keywords: | Cc: | felix.schwarz@…, jargon@… |
Description
This issue is originally reported at trac:#11184.
When an element with i18n:msg attribute has last element which has $var as contents and it is translated with "aaa [1:%(name)s] zzz", got IndexError: pop from empty list.
def test_translate_i18n_msg_ticket_404_regression(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <h1 i18n:msg="name">text <a>$name</a></h1> </html>""") gettext = lambda s: u'head [1:%(name)s] tail' translator = Translator(gettext) translator.setup(tmpl) self.assertEqual("""<html> <h1>head <a>NAME</a> tail</h1> </html>""", tmpl.generate(name='NAME').render())
Traceback (most recent call last): File "genshi/filters/tests/i18n.py", line 918, in test_translate_i18n_msg_ticket_404_regression self.assertEqual("""<html> File "/home/jun66j5/src/genshi/hg/genshi/core.py", line 183, in render return encode(generator, method=method, encoding=encoding, out=out) File "/home/jun66j5/src/genshi/hg/genshi/output.py", line 57, in encode return _encode(''.join(list(iterator))) File "/home/jun66j5/src/genshi/hg/genshi/output.py", line 241, in __call__ for kind, data, pos in stream: File "/home/jun66j5/src/genshi/hg/genshi/output.py", line 669, in __call__ for kind, data, pos in stream: File "/home/jun66j5/src/genshi/hg/genshi/output.py", line 774, in __call__ for kind, data, pos in chain(stream, [(None, None, None)]): File "/home/jun66j5/src/genshi/hg/genshi/output.py", line 594, in __call__ for ev in stream: File "/home/jun66j5/src/genshi/hg/genshi/core.py", line 288, in _ensure for event in stream: File "/home/jun66j5/src/genshi/hg/genshi/template/base.py", line 617, in _include for event in stream: File "/home/jun66j5/src/genshi/hg/genshi/template/markup.py", line 326, in _match for event in stream: File "/home/jun66j5/src/genshi/hg/genshi/template/base.py", line 557, in _flatten for kind, data, pos in stream: File "/home/jun66j5/src/genshi/hg/genshi/filters/i18n.py", line 177, in _generate for event in msgbuf.translate(gettext(msgbuf.format())): File "/home/jun66j5/src/genshi/hg/genshi/filters/i18n.py", line 1044, in translate events = self.events[order].pop(0) IndexError: pop from empty list
Attachments (1)
Change History (11)
Changed 12 years ago by jomae
comment:1 Changed 12 years ago by jomae
comment:2 Changed 11 years ago by felix.schwarz@…
- Cc felix.schwarz@… added
comment:3 Changed 11 years ago by dstoecker
Any reason not to apply this? I've the same issue #11184. I have 0.7 installed.
comment:4 Changed 11 years ago by hodgestar
- Owner changed from cmlenz to hodgestar
- Status changed from new to assigned
comment:5 Changed 11 years ago by hodgestar
- Resolution set to fixed
- Status changed from assigned to closed
comment:6 Changed 11 years ago by derhelge
Is it possible to update http://ftp.edgewall.com/pub/genshi/Genshi-0.7.tar.gz and also the complete download-page?
comment:7 Changed 11 years ago by hodgestar
New releases coming in the next week or so.
comment:8 Changed 10 years ago by dstoecker
Same issue here. Any new release coming?
comment:9 Changed 10 years ago by jargon@…
- Cc jargon@… added
comment:10 Changed 9 years ago by t.riedel@…
I have installed trac 1.0.9 and Genshi 0.7 two weeks ago. I'm a bit disappointed that this bug is still not solved in Genshi, see trac:comment:24:ticket:11184.
I created the patch, ticket566-genshi-0.6.x-r1238.diff. All tests pass.