Author: ianb
Date: 2008-11-15 13:57:10 -0700 (Sat, 15 Nov 2008)
New Revision: 3666
Modified:
FormEncode/trunk/docs/news.txt
FormEncode/trunk/formencode/htmlfill.py
FormEncode/trunk/tests/test_htmlfill.py
Log:
Don't overwrite the src attribute in <input type="image"> fields
(SF 1974350)
Modified: FormEncode/trunk/docs/news.txt
===================================================================
--- FormEncode/trunk/docs/news.txt 2008-11-15 20:54:28 UTC (rev 3665)
+++ FormEncode/trunk/docs/news.txt 2008-11-15 20:57:10 UTC (rev 3666)
@@ -12,7 +12,9 @@
* Added :meth:`formencode.api.Invalid.__unicode__`
* In :mod:`formencode.htmlfill` use a default encoding of utf8 when
- handling mixed ``str``/``unicode`` content.
+ handling mixed ``str``/``unicode`` content. Also do not modify
+ ``<input type="image">`` tags (previously ``src`` would be
+ overwritten, for no good reason).
* In :class:`formencode.validators.Email` allow single-character
domain names (like x.com).
Modified: FormEncode/trunk/formencode/htmlfill.py
===================================================================
--- FormEncode/trunk/formencode/htmlfill.py 2008-11-15 20:54:28 UTC (rev
3665)
+++ FormEncode/trunk/formencode/htmlfill.py 2008-11-15 20:57:10 UTC (rev
3666)
@@ -389,8 +389,6 @@
self.skip_next = True
self.add_key(name)
elif t == 'image':
- self.set_attr(attrs, 'src', value or
- self.get_attr(attrs, 'src', ''))
self.write_tag('input', attrs, startend)
self.skip_next = True
self.add_key(name)
Modified: FormEncode/trunk/tests/test_htmlfill.py
===================================================================
--- FormEncode/trunk/tests/test_htmlfill.py 2008-11-15 20:54:28 UTC (rev
3665)
+++ FormEncode/trunk/tests/test_htmlfill.py 2008-11-15 20:57:10 UTC (rev
3666)
@@ -123,3 +123,8 @@
assert (htmlfill.render('<form:error name="foo" />',
errors={'foo': htmlfill.htmlliteral('<test>')})
== '<span class="error-message"><test></span><br />\n')
+
+def test_image_submit():
+ assert (htmlfill.render('<input name="image-submit" type="image"
src="foo.jpg" value="bar">',
+ defaults={'image-submit': 'blahblah'})
+ == '<input name="image-submit" type="image" src="foo.jpg"
value="bar">')
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
FormEncode-CVS mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/formencode-cvs