[wwwsearch-commits] r19198 - wwwsearch/mechanize/trunk/mechanize
jjlee at codespeak.net
jjlee at codespeak.net
Sun Oct 30 19:57:29 CET 2005
Author: jjlee
Date: Sun Oct 30 19:57:28 2005
New Revision: 19198
Modified:
wwwsearch/mechanize/trunk/mechanize/_mechanize.py
Log:
Cleanup of lazy parsing (may fix bugs, not sure...)
Modified: wwwsearch/mechanize/trunk/mechanize/_mechanize.py
==============================================================================
--- wwwsearch/mechanize/trunk/mechanize/_mechanize.py (original)
+++ wwwsearch/mechanize/trunk/mechanize/_mechanize.py Sun Oct 30 19:57:28 2005
@@ -252,8 +252,7 @@
except IndexError:
raise BrowserStateError("already at start of history")
n -= 1
- if self._response is not None:
- self._parse_html(self._response)
+ self._parse_html(self._response)
return self._response
def links(self, **kwds):
@@ -267,10 +266,12 @@
self._links = list(self.get_links_iter())
finally:
self._response.seek(0)
- return list(self._links)
+ return self._links
def get_links_iter(self):
"""Return an iterator that provides links of the document."""
+ if not self.viewing_html():
+ raise BrowserStateError("not viewing HTML")
base = self._response.geturl()
self._response.seek(0)
p = pullparser.TolerantPullParser(
@@ -609,6 +610,4 @@
# result from parsing
self.form = None
self._title = None
- if not self.viewing_html():
- return
self._forms = self._links = None
More information about the wwwsearch-commits
mailing list