[wwwsearch-commits] r31398 - in wwwsearch/mechanize/trunk: mechanize test
jjlee at codespeak.net
jjlee at codespeak.net
Sat Aug 19 04:24:16 CEST 2006
Author: jjlee
Date: Sat Aug 19 04:24:14 2006
New Revision: 31398
Modified:
wwwsearch/mechanize/trunk/mechanize/_html.py
wwwsearch/mechanize/trunk/test/test_mechanize.py
Log:
Fix crash with </base> tag (yajdbgr02 at sneakemail.com)
Modified: wwwsearch/mechanize/trunk/mechanize/_html.py
==============================================================================
--- wwwsearch/mechanize/trunk/mechanize/_html.py (original)
+++ wwwsearch/mechanize/trunk/mechanize/_html.py Sat Aug 19 04:24:14 2006
@@ -163,11 +163,11 @@
p = self.link_parser_class(response, encoding=encoding)
for token in p.tags(*(self.urltags.keys()+["base"])):
+ if token.type == "endtag":
+ continue
if token.data == "base":
base_url = dict(token.attrs).get("href")
continue
- if token.type == "endtag":
- continue
attrs = dict(token.attrs)
tag = token.data
name = attrs.get("name")
Modified: wwwsearch/mechanize/trunk/test/test_mechanize.py
==============================================================================
--- wwwsearch/mechanize/trunk/test/test_mechanize.py (original)
+++ wwwsearch/mechanize/trunk/test/test_mechanize.py Sat Aug 19 04:24:14 2006
@@ -15,6 +15,17 @@
FACTORY_CLASSES.append(mechanize.RobustFactory)
+class RegressionTests(TestCase):
+
+ def test_close_base_tag(self):
+ # any document containing a </base> tag used to cause an exception
+ br = mechanize.Browser()
+ response = mechanize.make_response(
+ "</base>", [("Content-type", "text/html")], "", 200, "OK")
+ br.set_response(response)
+ list(br.links())
+
+
class CachingGeneratorFunctionTests(TestCase):
def _get_simple_cgenf(self, log):
More information about the wwwsearch-commits
mailing list