[Python-modules-commits] [webtest] 01/03: Import webtest_2.0.20.orig.tar.gz
Piotr Ożarowski
piotr at moszumanska.debian.org
Sun Dec 27 19:29:17 UTC 2015
This is an automated email from the git hooks/post-receive script.
piotr pushed a commit to branch master
in repository webtest.
commit bc7e1ee47592bfe7de671f16e266a7927884477a
Author: Piotr Ożarowski <piotr at debian.org>
Date: Sun Dec 27 20:25:02 2015 +0100
Import webtest_2.0.20.orig.tar.gz
---
.coveragerc | 20 ++
CHANGELOG.rst | 17 ++
MANIFEST.in | 2 +-
PKG-INFO | 4 +-
WebTest.egg-info/PKG-INFO | 4 +-
WebTest.egg-info/SOURCES.txt | 1 +
WebTest.egg-info/requires.txt | 6 +
docs/changelog.rst | 510 +-----------------------------------------
setup.cfg | 1 -
setup.py | 6 +-
tests/test_forms.py | 14 ++
tox.ini | 13 +-
webtest/app.py | 3 +-
webtest/forms.py | 25 ++-
14 files changed, 94 insertions(+), 532 deletions(-)
diff --git a/.coveragerc b/.coveragerc
new file mode 100644
index 0000000..45a256d
--- /dev/null
+++ b/.coveragerc
@@ -0,0 +1,20 @@
+[run]
+include =
+ */webtest/*.py
+omit =
+ */tests*
+ */docs/*.py
+ */site-packages*
+ */lib/python*
+ */lib-python*
+ */lib_pypy*
+ */src*
+
+[report]
+exclude_lines =
+ pragma: no cover
+ def __repr__
+ raise NotImplementedError
+ if __name__ == .__main__.:
+ def parse_args
+
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index 9ca100d..ba6e5c9 100755
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -1,6 +1,23 @@
News
====
+2.0.20 (2015-11-03)
+-------------------
+
+- nothing new release. just try to make wheel available on pypi
+
+
+2.0.19 (2015-11-01)
+-------------------
+
+- fixed #131 prevent passing HTML parameters that conflict with Field kwargs
+
+- fixed #135 Document that WSGIProxy2 is required for "using webtest with a real url"
+
+- fixed #136 reset values of select multiple
+
+- drop py32 support (still work but test dependencies fail)
+
2.0.18 (2015-02-05)
-------------------
diff --git a/MANIFEST.in b/MANIFEST.in
index 2d01ff6..1c1747c 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -2,6 +2,6 @@ graft docs
prune docs/_build
graft webtest
graft tests
-include *.rst *.cfg *.ini
+include *.rst *.cfg *.ini .coveragerc
global-exclude *.pyc
global-exclude __pycache__
diff --git a/PKG-INFO b/PKG-INFO
index fa76ee9..10ecde1 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: WebTest
-Version: 2.0.18
+Version: 2.0.20
Summary: Helper to test WSGI applications
Home-page: http://webtest.pythonpaste.org/
Author: Gael Pasgrimaud
@@ -30,5 +30,5 @@ Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.2
Classifier: Programming Language :: Python :: 3.3
+Classifier: Programming Language :: Python :: 3.4
diff --git a/WebTest.egg-info/PKG-INFO b/WebTest.egg-info/PKG-INFO
index fa76ee9..10ecde1 100644
--- a/WebTest.egg-info/PKG-INFO
+++ b/WebTest.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: WebTest
-Version: 2.0.18
+Version: 2.0.20
Summary: Helper to test WSGI applications
Home-page: http://webtest.pythonpaste.org/
Author: Gael Pasgrimaud
@@ -30,5 +30,5 @@ Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.2
Classifier: Programming Language :: Python :: 3.3
+Classifier: Programming Language :: Python :: 3.4
diff --git a/WebTest.egg-info/SOURCES.txt b/WebTest.egg-info/SOURCES.txt
index fb1593f..0676724 100644
--- a/WebTest.egg-info/SOURCES.txt
+++ b/WebTest.egg-info/SOURCES.txt
@@ -1,3 +1,4 @@
+.coveragerc
CHANGELOG.rst
MANIFEST.in
README.rst
diff --git a/WebTest.egg-info/requires.txt b/WebTest.egg-info/requires.txt
index 288af00..4c199bb 100644
--- a/WebTest.egg-info/requires.txt
+++ b/WebTest.egg-info/requires.txt
@@ -3,6 +3,9 @@ WebOb>=1.2
waitress>=0.8.5
beautifulsoup4
+[:python_version=="2.6"]
+ordereddict
+
[tests]
nose<1.3.0
coverage
@@ -10,3 +13,6 @@ mock
PasteDeploy
WSGIProxy2
pyquery
+
+[tests:python_version=="2.6"]
+unittest2
diff --git a/docs/changelog.rst b/docs/changelog.rst
deleted file mode 100755
index 9ca100d..0000000
--- a/docs/changelog.rst
+++ /dev/null
@@ -1,509 +0,0 @@
-News
-====
-
-2.0.18 (2015-02-05)
--------------------
-
-- Avoid deprecation warning with py3.4
-
-
-2.0.17 (2014-12-20)
--------------------
-
-- Properly check for default cookiejar arguments
- [Julian Berman]
-
-- Avoid raising encoding errors from debugapp (needed to use with WSGIProxy2)
- [Laurence Rowe]
-
-
-2.0.16 (2014-09-19)
--------------------
-
-- Fixed #110. Forced values for Radio inputs are no longer ignored by value
- property on get.
- [bayprogrammer]
-
-- Added method TestApp.set_parser_features to change the parser_features used
- by BeautifulSoup.
- [tomasmoreyra]
-
-- Added app.set_cookie
- [luhn]
-
-
-2.0.15 (2014-04-17)
--------------------
-
-- Fixed #73. Python < 2.6.5 does not support unicode as keyword arguments names.
- [Stepan Kolesnik]
-
-- Fixed #84 Application cookies for localhost are no longer ignored
- [gawel]
-
-- Fixed #89 remove WSGIWarning: You are not supposed to send a body in a DELETE
- request because we now have a good reason for that. See http://bit.ly/1tb3yxW
- [gawel]
-
-- Fixed #92 You can now override TestApp.JSONEncoder to use a custom encoder
- [gawel]
-
-- Fixed #93 Support basic authentication
- [gawel]
-
-- Fixed #103 Broken "Edit me on GitHub" links in documentation
- [gawel]
-
-- Fixed #106 Make wrapping the app in the lint middleware optional
- [dmlayton]
-
-- Fixed #107 Explicit error message when WSGIProxy2 is not installer
- [gawel]
-
-- Fixed #108 cgi.parse_qsl is pending deprecation
- [gawel]
-
-2.0.14 (2014-01-23)
--------------------
-
-- Allow `.select()` on <select>s and <select multiple>s.
- [Markus Bertheau]
-
-
-2.0.13 (2014-01-23)
--------------------
-
-- Allow selecting <select> options by text
- [Markus Bertheau]
-
-
-2.0.12 (2014-01-17)
--------------------
-
-- Ignore the `value` attribute of file inputs
- [Markus Bertheau]
-
-- Allow selecting the form submit button by its value
- [Markus Bertheau]
-
-
-2.0.11 (2013-12-29)
--------------------
-
-- Depend on `unittest2` only for Python versions lower than 2.7
- [iElectric]
-
-- Add an optional parameter to `TestApp`, allowing the user to specify the
- parser used by BeautifulSoup
- [lyndsysimon]
-
-
-2.0.10 (2013-11-14)
--------------------
-
-- Make StopableWSGIServer thread daemonic
- [lrowe]
-
-
-2.0.9 (2013-09-18)
-------------------
-
-- Make sure Upload.content_type is not ignored
- https://github.com/Pylons/webtest/pull/88
- [Marius Gedminas]
-
-
-2.0.8 (2013-09-17)
-------------------
-
-- Allow checking/unchecking a set of same-named checkboxes by assigning a list of values.
- [carljm]
-
-- fix "AttributeError: 'InputWrapper' object has no attribute 'seek'"
- [iElectric]
-
-- Added `xhr=True` parameter to `TestApp.get`, `TestApp.post`, `TestApp.head`, `TestApp.delete`
- [kharandziuk]
-
-- Remove old (and broken?) casperjs/selenium backward compat imports. Fix
- https://github.com/gawel/webtest-selenium/issues/9
- [gawel]
-
-- Allow optionally specifying the MIME type of an uploaded form file. Fixes #86
- [Marius Gedminas]
-
-
-2.0.7 (2013-08-07)
-------------------
-
-- Detect JSON if mimetype ends with +json, such as application/vnd.webtest+json
- [homm]
-
-- Fixed #72. Use WSGIServer new api even if there waitress has backward compat.
- [gawel]
-
-- Fixed #50. Corrected default value for the delete params argument.
- [noonat]
-
-- Be sure to decode the content if it is gziped before returning it
- [Alexis Métaireau]
-
-
-2.0.6 (2013-05-23)
-------------------
-
-- fixed #64. cookiejar api has changed in python3.3 [gawel]
-
-- allow to use a fixed StopableWSGIServer [gawel]
-
-- Do not alter the BeautifulSoup object when parsing forms. [Georges
- Dubus]
-
-- Remove first newline while parse textarea block, how modern browsers does.
- [Victor Safronovich] pull #69
-
-
-2.0.5 (2013-04-12)
-------------------
-
-* Ignore select.error (not socket.error) following
- StopableWSGIServer.shutdown. [Laurence Rowe]
-
-* Handle the short form of <select multiple> [Marius Gedminas]
-
-
-2.0.4 (2013-03-28)
-------------------
-
-* Correctly handle <option> elements with no value attribute
- [Marius Gedminas]
-
-* Ignore socket.error following StopableWSGIServer.shutdown. [Laurence Rowe]
-
-* <button> without type='submit' attribute is treated as Submit
- control [Andrey Lebedev].
-
-* Support for redirects having relative "Location" header [Andrey Lebedev]
-
-
-2.0.3 (2013-03-19)
-------------------
-
-* Treat strings in the WSGI environment as native strings, compliant with
- PEP-3333. [wosc]
-
-
-2.0.2 (2013-03-15)
-------------------
-
-* Allow TestResponse.click() to match HTML content again. [ender672]
-
-* Support secure cookies [Andrey Lebedev]
-
-2.0.1 (2013-03-05)
-------------------
-
-* Added Pasword field [diarmuidbourke]
-
-* re-allow to use unknow field type. Like ``type="email"``. [gawel]
-
-* Don't let BeautifulSoup use lxml. Fix GH-51 [kmike]
-
-* added :meth:`webtest.response.TestResponse.maybe_follow` method [kmike]
-
-2.0 (2013-02-25)
-----------------
-
-* drop zc.buildout usage for development, now using only virtualenv
- [Domen Kožar]
-
-* Backward incompatibility : Removed the ``anchor`` argument of
- :meth:`webtest.response.TestResponse.click` and the ``button`` argument of
- :meth:`webtest.response.TestResponse.clickbutton`. It is for the greater good.
- [madjar]
-
-* Rewrote API documentation [Domen Kožar]
-
-* Added `wsgiproxy` support to do HTTP request to an URL [gawel]
-
-* Use BeautifulSoup4 to parse forms [gawel]
-
-* Added `webtest.app.TestApp.patch_json` [gawel]
-
-* Implement `webtest.app.TestApp.cookiejar` support and kindof keep
- `webtest.app.TestApp.cookies` functionality. `webtest.app.TestApp.cookies`
- should be treated as read-only.
- [Domen Kožar]
-
-* Split Selenium integration into separate package webtest-selenium
- [gawel]
-
-* Split casperjs integration into separate package webtest-casperjs
- [gawel]
-
-* Test coverage improvements [harobed, cdevienne, arthru, Domen Kožar, gawel]
-
-* Fully implement decoding of HTML entities
-
-* Fix tox configuration
-
-1.4.2
------
-
-* fix tests error due to CLRF in a tarball
-
-1.4.1
------
-
-* add travis-ci
-
-* migrate repository to https://github.com/Pylons/webtest
-
-* Fix a typo in apps.py: selectedIndicies
-
-* Preserve field order during parsing (support for deform and such)
-
-* allow equals sign in the cookie by spliting name-value-string pairs on
- the first '=' sign as per
- http://tools.ietf.org/html/rfc6265#section-5.2
-
-* fix an error when you use AssertionError(response) with unicode chars in
- response
-
-1.4.0
------
-
-* added webtest.ext - allow to use casperjs
-
-1.3.6
-------
-
-* fix `#42 <https://bitbucket.org/ianb/webtest/issue/42>`_ Check uppercase
- method.
-
-* fix `#36 <https://bitbucket.org/ianb/webtest/issue/36>`_ Radio can use forced
- value.
-
-* fix `#24 <https://bitbucket.org/ianb/webtest/issue/24>`_ Include test
- fixtures.
-
-* fix bug when trying to print a response which contain some unicode chars
-
-1.3.5
-------
-
-* fix `#39 <https://bitbucket.org/ianb/webtest/issue/39>`_ Add PATCH to
- acceptable methods.
-
-
-1.3.4
------
-
-* fix `#33 <https://bitbucket.org/ianb/webtest/issue/33>`_ Remove
- CaptureStdout. Do nothing and break pdb
-
-* use OrderedDict to store fields in form. See
- `#31 <https://bitbucket.org/ianb/webtest/issue/31>`_
-
-* fix `#38 <https://bitbucket.org/ianb/webtest/issue/38>`_ Allow to post falsey
- values.
-
-* fix `#37 <https://bitbucket.org/ianb/webtest/issue/37>`_ Allow
- Content-Length: 0 without Content-Type
-
-* `fix #30 <https://bitbucket.org/ianb/webtest/issue/30>`_ bad link to pyquery
- documentation
-
-* Never catch NameError during iteration
-
-1.3.3
------
-
-* added ``post_json``, ``put_json``, ``delete_json``
-
-* fix `#25 <https://bitbucket.org/ianb/webtest/issue/25>`_ params dictionary of
- webtest.AppTest.post() does not support unicode values
-
-1.3.2
------
-
-* improve showbrowser. fixed `#23 <https://bitbucket.org/ianb/webtest/issue/23>`_
-
-* print_stderr fail with unicode string on python2
-
-1.3.1
------
-
-* Added .option() `#20 <https://bitbucket.org/ianb/webtest/issue/20>`_
-
-* Fix #21
-
-* Full python3 compat
-
-1.3
----
-
-* Moved TestApp to app.py
-
-* Added selenium testing framework. See :mod:`~webtest.sel` module.
-
-
-1.2.4
-------
-
-* Accept lists for ``app.post(url, params=[...])``
-
-* Allow to use url that starts with the SCRIPT_NAME found in extra_environ
-
-* Fix `#16 <https://bitbucket.org/ianb/webtest/issue/16>`_ Default
- content-type is now correctly set to `application/octet-stream`
-
-* Fix `#14 and #18 <https://bitbucket.org/ianb/webtest/issue/18>`_ Allow to use
- `.delete(params={})`
-
-* Fix `#12 <https://bitbucket.org/ianb/webtest/issue/12>`_
-
-
-1.2.3
------
-
-* Fix `#10
- <http://bitbucket.org/ianb/webtest/issue/10/testapprequest-method-overwrites-specifics-with-testapp-scoped>`_,
- now `TestApp.extra_environ` doesn't take precedence over a WSGI
- environment passed in through the request.
-
-* Removed stray print
-
-1.2.2
------
-
-* Revert change to cookies that would add ``"`` around cookie values.
-
-* Added property :meth:`webtest.Response.pyquery` which returns a
- `PyQuery <http://pyquery.org/>`_ object.
-
-* Set base_url on ``resp.lxml``
-
-* Include tests and docs in tarball.
-
-* Fix sending in webob.Request (or webtest.TestRequest) objects.
-
-* Fix handling forms with file uploads, when no file is selected.
-
-* Added ``extra_environ`` argument to :meth:`webtest.TestResponse.click`.
-
-* Fixed/added wildcard statuses, like ``status="4*"``
-
-* Fix file upload fields in forms: allow upload field to be empty.
-
-* Added support for single-quoted html attributes.
-
-* `TestResponse` now has unicode support. It is turned on by default
- for all responses with charset information. **This is backward
- incompatible change** if you rely (e.g. in doctests) on parsed
- form fields or responses returned by `json` and `lxml` methods
- being encoded strings when charset header is in response. In order
- to switch to old behaviour pass `use_unicode=False` flag to
- `TestApp` constructor.
-
-
-1.2.1
------
-
-* Added method :meth:`TestApp.request`, which can be used for
- sending requests with different methods (e.g., ``MKCOL``). This
- method sends all its keyword arguments to
- :meth:`webtest.TestRequest.blank` and then executes the request.
- The parameters are somewhat different than other methods (like
- :meth:`webtest.TestApp.get`), as they match WebOb's attribute
- names exactly (the other methods were written before WebOb existed).
-
-* Removed the copying of stdout to stderr during requests.
-
-* Fix file upload fields in forms (`#340
- <http://trac.pythonpaste.org/pythonpaste/ticket/340>`_) -- you could
- upload files with :meth:`webtest.TestApp.post`, but if you use
- ``resp.form`` file upload fields would not work (from rcs-comp.com
- and Matthew Desmarais).
-
-1.2
----
-
-* Fix form inputs; text inputs always default to the empty string, and
- unselected radio inputs default to nothing at all. From Daniele
- Paolella.
-
-* Fix following links with fragments (these fragments should not be
- sent to the WSGI application). From desmaj.
-
-* Added ``force_value`` to select fields, like
- ``res.form['select'].force_value("new_value")``. This makes it
- possible to simulate forms that are dynamically updated. From
- Matthew Desmarais.
-
-* Fixed :meth:`webtest.Response.mustcontain` when you pass in a
- ``no=[strings]`` argument.
-
-1.1
----
-
-* Changed the ``__str__`` of responses to make them more doctest
- friendly:
-
- - All headers are displayed capitalized, like Content-Type
- - Headers are sorted alphabetically
-
-* Changed ``__repr__`` to only show the body length if the complete
- body is not shown (for short bodies the complete body is in the
- repr)
-
-* Note: **these are backward incompatible changes** if you are using
- doctest (you'll have to update your doctests with the new format).
-
-* Fixed exception in the ``.delete`` method.
-
-* Added a ``content_type`` argument to ``app.post`` and ``app.put``,
- which sets the ``Content-Type`` of the request. This is more
- convenient when testing REST APIs.
-
-* Skip links in ``<script>...</script>`` tags (since that's not real
- markup).
-
-1.0.2
------
-
-* Don't submit unnamed form fields.
-
-* Checkboxes with no explicit ``value`` send ``on`` (previously they
- sent ``checked``, which isn't what browsers send).
-
-* Support for ``<select multiple>`` fields (from Matthew Desmarais)
-
-1.0.1
----
-
-* Fix the ``TestApp`` validator's InputWrapper lacking support for
- readline with an argument as needed by the cgi module.
-
-1.0
----
-
-* Keep URLs in-tact in cases such as
- ``app.get('http://www.python.org')`` (so HTTP_HOST=www.python.org,
- etc).
-
-* Fix ``lxml.html`` import, so lxml 2.0 users can get HTML lxml
- objects from ``resp.lxml``
-
-* Treat ``<input type="image">`` like a submit button.
-
-* Use ``BaseCookie`` instead of ``SimpleCookie`` for storing cookies
- (avoids quoting cookie values).
-
-* Accept any ``params`` argument that has an ``items`` method (like
- MultiDict)
-
-0.9
----
-
-Initial release
diff --git a/docs/changelog.rst b/docs/changelog.rst
new file mode 120000
index 0000000..e22698b
--- /dev/null
+++ b/docs/changelog.rst
@@ -0,0 +1 @@
+../CHANGELOG.rst
\ No newline at end of file
diff --git a/setup.cfg b/setup.cfg
index 793753f..948593f 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -10,7 +10,6 @@ doctest-fixtures = _fixt
include = docs
exclude = (CHANGELOG|contributing).rst
cover-package = webtest
-with-coverage = 1
doctest-options = +ELLIPSIS,+NORMALIZE_WHITESPACE
[egg_info]
diff --git a/setup.py b/setup.py
index 09034df..f6911f8 100644
--- a/setup.py
+++ b/setup.py
@@ -5,7 +5,7 @@ import sys
from setuptools import setup
from setuptools import find_packages
-version = '2.0.18'
+version = '2.0.20'
install_requires = [
'six',
@@ -39,8 +39,8 @@ setup(name='WebTest',
"Programming Language :: Python :: 2.6",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
- "Programming Language :: Python :: 3.2",
"Programming Language :: Python :: 3.3",
+ "Programming Language :: Python :: 3.4",
],
keywords='wsgi test unit tests web',
author='Ian Bicking',
@@ -62,7 +62,9 @@ setup(name='WebTest',
test_suite='nose.collector',
tests_require=tests_require,
extras_require={
+ ':python_version=="2.6"': ['ordereddict'],
'tests': tests_require,
+ 'tests:python_version=="2.6"': ['unittest2'],
},
entry_points="""
[paste.app_factory]
diff --git a/tests/test_forms.py b/tests/test_forms.py
index 0d7bda4..474e766 100644
--- a/tests/test_forms.py
+++ b/tests/test_forms.py
@@ -720,6 +720,20 @@ class TestSelect(unittest.TestCase):
display = multiple_form.submit("button")
self.assertIn("<p>You selected Nine, Ten</p>", display, display)
+ def test_multiple_select_reset_value(self):
+ app = webtest.TestApp(select_app_without_values)
+ res = app.get('/')
+ self.assertEqual(res.status_int, 200)
+ self.assertEqual(res.headers['content-type'],
+ 'text/html; charset=utf-8')
+ self.assertEqual(res.content_type, 'text/html')
+
+ multiple_form = res.forms["multiple_select_form"]
+ self.assertEqual(multiple_form["multiple"].value, ["Nine", "Eleven"])
+ multiple_form["multiple"].force_value(None)
+ self.assertIsNone(multiple_form["multiple"].value)
+ display = multiple_form.submit("button")
+ self.assertIn("<p>You selected </p>", display, display)
class SingleUploadFileApp(object):
diff --git a/tox.ini b/tox.ini
index 5e6f9e0..b183e0d 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,11 +1,11 @@
[tox]
-envlist=py32,py33,py26,py27,coverage
+envlist=py33,py34,py26,py27,coverage
[testenv]
commands =
{envbindir}/python --version
{envbindir}/pip freeze
- {envbindir}/nosetests --with-xunit --xunit-file=nosetests-{envname}.xml []
+ {envbindir}/nosetests --with-coverage --with-xunit --xunit-file=nosetests-{envname}.xml []
{envbindir}/coverage xml -o coverage-{envname}.xml
setenv =
LC_ALL=C
@@ -58,6 +58,15 @@ deps =
{[common]deps}
{[PY3]deps}
+[testenv:py34]
+deps =
+ {[common]deps}
+ {[PY3]deps}
+commands =
+ {envbindir}/python --version
+ {envbindir}/pip freeze
+ {envbindir}/nosetests
+
[testenv:coverage]
deps =
coverage
diff --git a/webtest/app.py b/webtest/app.py
index fad78ea..8110ed8 100644
--- a/webtest/app.py
+++ b/webtest/app.py
@@ -99,7 +99,8 @@ class TestApp(object):
.. versionadded:: 2.0
It can also be an actual full URL to an http server and webtest
- will proxy requests with `wsgiproxy`.
+ will proxy requests with `WSGIProxy2
+ <https://pypi.python.org/pypi/WSGIProxy2/>`_.
:type app:
WSGI application
:param extra_environ:
diff --git a/webtest/forms.py b/webtest/forms.py
index b84c08f..e64c6f7 100644
--- a/webtest/forms.py
+++ b/webtest/forms.py
@@ -167,7 +167,7 @@ class MultipleSelect(Field):
self.options = []
# Undetermined yet:
self.selectedIndices = []
- self._forced_values = []
+ self._forced_values = NoValue
def force_value(self, values):
"""Like setting a value, except forces it (even for, say, hidden
@@ -215,21 +215,16 @@ class MultipleSelect(Field):
', '.join([repr(o) for o, c, t in self.options])))
def value__get(self):
- selected_values = []
- if self.selectedIndices:
- selected_values = [self.options[i][0]
- for i in self.selectedIndices]
- elif not self._forced_values:
+ if self._forced_values is not NoValue:
+ return self._forced_values
+ elif self.selectedIndices:
+ return [self.options[i][0] for i in self.selectedIndices]
+ else:
selected_values = []
for option, checked, text in self.options:
if checked:
selected_values.append(option)
- if self._forced_values:
- selected_values += self._forced_values
-
- if self.options and (not selected_values):
- selected_values = None
- return selected_values
+ return selected_values if selected_values else None
value = property(value__get, value__set)
@@ -452,6 +447,12 @@ class Form(object):
attrs = dict((k.encode('utf-8') if isinstance(k, unicode)
else k, v) for k, v in attrs.items())
+ # https://github.com/Pylons/webtest/issues/131
+ reserved_attributes = ('form', 'tag', 'pos')
+ for attr in reserved_attributes:
+ if attr in attrs:
+ del attrs[attr]
+
if tag == 'input':
if tag_type == 'radio':
field = fields.get(name)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/webtest.git
More information about the Python-modules-commits
mailing list