mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-05-13 09:03:11 +00:00
LinkFinder does not raise StopParse
This commit is contained in:
parent
ee6628a831
commit
d189445a8e
2 changed files with 3 additions and 15 deletions
|
|
@ -116,14 +116,8 @@ def find_links (url_data, callback, tags):
|
|||
"""Parse into content and search for URLs to check.
|
||||
Found URLs are added to the URL queue.
|
||||
"""
|
||||
# construct handler object
|
||||
handler = linkparse.LinkFinder(callback, tags)
|
||||
# parse
|
||||
try:
|
||||
htmlsoup.process_soup(handler, url_data.get_soup())
|
||||
except linkparse.StopParse as msg:
|
||||
log.debug(LOG_CHECK, "Stopped parsing: %s", msg)
|
||||
pass
|
||||
htmlsoup.process_soup(handler, url_data.get_soup())
|
||||
|
||||
|
||||
def parse_firefox (url_data):
|
||||
|
|
|
|||
|
|
@ -30,10 +30,7 @@ class TestLinkparser (unittest.TestCase):
|
|||
def _test_one_link (self, content, url):
|
||||
self.count_url = 0
|
||||
h = linkparse.LinkFinder(self._test_one_url(url), linkparse.LinkTags)
|
||||
try:
|
||||
htmlsoup.process_soup(h, htmlsoup.make_soup(content))
|
||||
except linkparse.StopParse:
|
||||
pass
|
||||
htmlsoup.process_soup(h, htmlsoup.make_soup(content))
|
||||
self.assertEqual(self.count_url, 1)
|
||||
|
||||
def _test_one_url (self, origurl):
|
||||
|
|
@ -47,10 +44,7 @@ class TestLinkparser (unittest.TestCase):
|
|||
def callback (url, line, column, name, base):
|
||||
self.assertTrue(False, 'URL %r found' % url)
|
||||
h = linkparse.LinkFinder(callback, linkparse.LinkTags)
|
||||
try:
|
||||
htmlsoup.process_soup(h, htmlsoup.make_soup(content))
|
||||
except linkparse.StopParse:
|
||||
pass
|
||||
htmlsoup.process_soup(h, htmlsoup.make_soup(content))
|
||||
|
||||
def test_href_parsing (self):
|
||||
# Test <a href> parsing.
|
||||
|
|
|
|||
Loading…
Reference in a new issue