summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Bicking <ian@ianbicking.org>2007-07-13 17:18:30 +0000
committerIan Bicking <ian@ianbicking.org>2007-07-13 17:18:30 +0000
commit62c15734ff03b4d88aba70401967fd1a48b656f1 (patch)
treea37ee787ff8c6154b565f66087b0ea3a13160c31
parent22e604f73ba10a948e4e6b8f9e4a956dbd6eb359 (diff)
downloadpaste-git-62c15734ff03b4d88aba70401967fd1a48b656f1.tar.gz
Fix problem with .form and named forms
-rw-r--r--docs/news.txt3
-rw-r--r--paste/fixture.py11
2 files changed, 10 insertions, 4 deletions
diff --git a/docs/news.txt b/docs/news.txt
index ab69d85..a66b37c 100644
--- a/docs/news.txt
+++ b/docs/news.txt
@@ -12,6 +12,9 @@ svn trunk
* Added a ``current`` method (an alias of ``current_conf``) to
``paste.config.DispatchingConfig``.
+* Make test response ``.form`` attribute work when you have a single
+ named form.
+
1.4
---
diff --git a/paste/fixture.py b/paste/fixture.py
index e43d59d..9e2e1cb 100644
--- a/paste/fixture.py
+++ b/paste/fixture.py
@@ -505,10 +505,13 @@ class TestResponse(object):
def form__get(self):
forms = self.forms
- assert len(forms) > 0, (
- "You used response.form, but no forms exist")
- assert len(forms) == 1, (
- "You used response.form, but more than one form exists")
+ if not forms:
+ raise TypeError(
+ "You used response.form, but no forms exist")
+ if 1 in forms:
+ # There is more than one form
+ raise TypeError(
+ "You used response.form, but more than one form exists")
return forms[0]
form = property(form__get,