diff options
author | Gael Pasgrimaud <gael@gawel.org> | 2014-04-16 21:34:16 +0200 |
---|---|---|
committer | Gael Pasgrimaud <gael@gawel.org> | 2014-04-16 21:34:16 +0200 |
commit | 9a51912f4e63b55d11e80fa5b41312a3c1d0094c (patch) | |
tree | 4310f3d6c6c82246e4a159e4aa14472921cec0c4 | |
parent | ae46ba7be556c43365a88edba6af5ae45efb5d07 (diff) | |
download | webtest-9a51912f4e63b55d11e80fa5b41312a3c1d0094c.tar.gz |
Fixed #73. Python < 2.6.5 does not support unicode as keyword arguments names.
-rw-r--r-- | CHANGELOG.rst | 7 | ||||
-rw-r--r-- | webtest/forms.py | 7 |
2 files changed, 14 insertions, 0 deletions
diff --git a/CHANGELOG.rst b/CHANGELOG.rst index e232ae2..09ec763 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,13 +4,20 @@ News 2.0.15 (unreleased) ------------------- +- Fixed #73. Python < 2.6.5 does not support unicode as keyword arguments names. + [Stepan Kolesnik] + - Fixed #92 You can now override TestApp.JSONEncoder to use a custom encoder + [gawel] - Fixed #93 Support basic authentication + [gawel] - Fixed #107 Explicit error message when WSGIProxy2 is not installer + [gawel] - Fixed #103 Broken "Edit me on GitHub" links in documentation + [gawel] 2.0.14 (2014-01-23) diff --git a/webtest/forms.py b/webtest/forms.py index 82ece13..a6df599 100644 --- a/webtest/forms.py +++ b/webtest/forms.py @@ -2,6 +2,7 @@ """Helpers to fill and submit forms.""" import re +import sys from bs4 import BeautifulSoup from webtest.compat import OrderedDict @@ -444,6 +445,12 @@ class Form(object): FieldClass = self.FieldClass.classes.get(tag_type, self.FieldClass) + + # https://github.com/Pylons/webtest/issues/73 + if sys.version_info[:2] <= (2, 6): + attrs = dict((k.encode('utf-8') if isinstance(k, unicode) + else k, v) for k, v in attrs.items()) + if tag == 'input': if tag_type == 'radio': field = fields.get(name) |