# HG changeset patch # User cmlenz # Date 1273500175 0 # Node ID 5fd4a1e283518f85ac53adf3e817544b7c9f256f # Parent 2772fa7c10a388922fc27a3a9b4521029a1a3356 Fix for bug with the `HTMLFormFiller` in the handling of textareas. Thanks to Trevor Morgan for pointing this out on the mailing list. diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Version 0.6.1 +http://svn.edgewall.org/repos/genshi/tags/0.6.1/ +(???, from branches/stable/0.6.x) + + * Fix for error in how `HTMLFormFiller` would handle `textarea` elements if + no value was not supplied form them. + + Version 0.6 http://svn.edgewall.org/repos/genshi/tags/0.6.0/ (Apr 22 2010, from branches/stable/0.6.x) diff --git a/genshi/filters/html.py b/genshi/filters/html.py --- a/genshi/filters/html.py +++ b/genshi/filters/html.py @@ -183,9 +183,10 @@ no_option_value = False option_start = option_value = None option_text = [] - elif tagname == 'textarea': + elif in_textarea and tagname == 'textarea': if textarea_value: yield TEXT, unicode(textarea_value), pos + textarea_value = None in_textarea = False yield kind, data, pos diff --git a/genshi/filters/tests/html.py b/genshi/filters/tests/html.py --- a/genshi/filters/tests/html.py +++ b/genshi/filters/tests/html.py @@ -92,6 +92,28 @@

""", html.render()) + def test_fill_textarea_multiple(self): + # Ensure that the subsequent textarea doesn't get the data from the + # first + html = HTML("""

+ + +

""") | HTMLFormFiller(data={'foo': 'Some text'}) + self.assertEquals("""

+ + + +

""") | HTMLFormFiller(data={'foo': 'Some text'}) + self.assertEquals("""

+ + +

""", html.render()) + def test_fill_input_checkbox_no_value(self): html = HTML("""