42 lines
1.5 KiB
Diff
42 lines
1.5 KiB
Diff
Index: genshi/filters/i18n.py
|
|
===================================================================
|
|
--- genshi/filters/i18n.py (revision 1238)
|
|
+++ genshi/filters/i18n.py (working copy)
|
|
@@ -1041,7 +1041,11 @@
|
|
|
|
while parts:
|
|
order, string = parts.pop(0)
|
|
- events = self.events[order].pop(0)
|
|
+ events = self.events[order]
|
|
+ if events:
|
|
+ events = events.pop(0)
|
|
+ else:
|
|
+ events = [(None, -1, -1)]
|
|
parts_counter[order].pop()
|
|
|
|
for event in events:
|
|
Index: genshi/filters/tests/i18n.py
|
|
===================================================================
|
|
--- genshi/filters/tests/i18n.py (revision 1238)
|
|
+++ genshi/filters/tests/i18n.py (working copy)
|
|
@@ -906,7 +906,19 @@
|
|
"""</p></html>""",
|
|
tmpl.generate(first="FIRST", second="SECOND").render())
|
|
|
|
+ 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())
|
|
|
|
+
|
|
class ChooseDirectiveTestCase(unittest.TestCase):
|
|
|
|
def test_translate_i18n_choose_as_attribute(self):
|