[Zope3-checkins] SVN: Zope3/trunk/src/zope/testbrowser/ fix bug
caused be impedance mis-match between Mechanize and zope.testbrowser
Benji York
benji at zope.com
Wed Dec 7 11:59:08 EST 2005
Log message for revision 40628:
fix bug caused be impedance mis-match between Mechanize and zope.testbrowser
Changed:
U Zope3/trunk/src/zope/testbrowser/README.txt
U Zope3/trunk/src/zope/testbrowser/ftests/navigate.html
U Zope3/trunk/src/zope/testbrowser/testing.py
-=-
Modified: Zope3/trunk/src/zope/testbrowser/README.txt
===================================================================
--- Zope3/trunk/src/zope/testbrowser/README.txt 2005-12-07 16:49:18 UTC (rev 40627)
+++ Zope3/trunk/src/zope/testbrowser/README.txt 2005-12-07 16:59:07 UTC (rev 40628)
@@ -1130,3 +1130,15 @@
Traceback (most recent call last):
...
AttributeError: 'Link' object has no attribute 'nonexistant'
+
+Fixed Bugs
+----------
+
+This section includes tests for bugs that were found and then fixed that don't
+fit into the more documentation-centric sections above.
+
+When URLs have spaces in them, they're handled correctly (before the bug was
+fixed, you'd get "ValueError: too many values to unpack"):
+
+ >>> browser.open('http://localhost/@@/testbrowser/navigate.html')
+ >>> browser.getLink('Spaces in the URL').click()
Modified: Zope3/trunk/src/zope/testbrowser/ftests/navigate.html
===================================================================
--- Zope3/trunk/src/zope/testbrowser/ftests/navigate.html 2005-12-07 16:49:18 UTC (rev 40627)
+++ Zope3/trunk/src/zope/testbrowser/ftests/navigate.html 2005-12-07 16:59:07 UTC (rev 40628)
@@ -18,6 +18,8 @@
<a href="navigate.html?message=By+Id" id="anchorid">By Anchor Id</a>
+ <a href="navigate.html?message=Spaces in URL">Spaces in the URL</a>
+
<form action="navigate.html" method="post">
<input name="message" value="By Form Submit" />
<input type="submit" name="submit-form" value="Submit" />
Modified: Zope3/trunk/src/zope/testbrowser/testing.py
===================================================================
--- Zope3/trunk/src/zope/testbrowser/testing.py 2005-12-07 16:49:18 UTC (rev 40627)
+++ Zope3/trunk/src/zope/testbrowser/testing.py 2005-12-07 16:59:07 UTC (rev 40628)
@@ -36,6 +36,11 @@
def set_debuglevel(self, level):
pass
+ def _quote(self, url):
+ # the publisher expects to be able to split on whitespace, so we have
+ # to make sure there is none in the URL
+ return url.replace(' ', '%20')
+
def request(self, method, url, body=None, headers=None):
"""Send a request to the publisher.
@@ -47,6 +52,7 @@
if url == '':
url = '/'
+ url = self._quote(url)
# Extract the handle_error option header
handle_errors_key = 'X-zope-handle-errors'
handle_errors = headers.get(handle_errors_key, True)
More information about the Zope3-Checkins
mailing list