# HG changeset patch # User cmlenz # Date 1182967223 0 # Node ID a40ad8334f0f1b8b0b853aecf58e95438e4f4eda # Parent f9ad40cae2f712e26e068c7b0f557d6672ab9c1f Ported [643] to 0.4.x branch. diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Version 0.4.3 +http://svn.edgewall.org/repos/genshi/tags/0.4.3/ +(?, from branches/stable/0.4.x) + + * The I18n filter no longer extracts or translates literal strings in + attribute values that also contain expressions. + + Version 0.4.2 http://svn.edgewall.org/repos/genshi/tags/0.4.2/ (Jun 20, from branches/stable/0.4.x) diff --git a/genshi/filters/i18n.py b/genshi/filters/i18n.py --- a/genshi/filters/i18n.py +++ b/genshi/filters/i18n.py @@ -158,7 +158,7 @@ newval = self.translate(value) else: newval = list(self(_ensure(value), ctxt, - search_text=name in include_attrs) + search_text=False) ) if newval != value: value = newval @@ -259,7 +259,7 @@ else: for lineno, funcname, text in self.extract( _ensure(value), gettext_functions, - search_text=name in self.include_attrs): + search_text=False): yield lineno, funcname, text elif search_text and kind is TEXT: diff --git a/genshi/filters/tests/i18n.py b/genshi/filters/tests/i18n.py --- a/genshi/filters/tests/i18n.py +++ b/genshi/filters/tests/i18n.py @@ -83,6 +83,14 @@ self.assertEqual(1, len(messages)) self.assertEqual((2, None, u'(c) 2007 Edgewall Software'), messages[0]) + def test_ignore_attribute_with_expression(self): + tmpl = MarkupTemplate(""" + + """) + translator = Translator() + messages = list(translator.extract(tmpl.stream)) + self.assertEqual(0, len(messages)) + class ExtractTestCase(unittest.TestCase):