mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-05-12 08:33:10 +00:00
Improved and tested opera bookmark parser
git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@3863 e7d03fd6-7b0d-0410-9947-9c21f3af8025
This commit is contained in:
parent
9ab895751f
commit
42c3e71329
2 changed files with 9 additions and 6 deletions
|
|
@ -835,11 +835,9 @@ class UrlBase (object):
|
|||
self.aggregate.urlqueue.put(url_data)
|
||||
|
||||
def parse_opera (self):
|
||||
"""
|
||||
Parse an opera bookmark file.
|
||||
"""
|
||||
"""Parse an opera bookmark file."""
|
||||
log.debug(LOG_CHECK, "Parsing Opera bookmarks %s", self)
|
||||
name = ""
|
||||
name = None
|
||||
lineno = 0
|
||||
for line in self.get_content().splitlines():
|
||||
lineno += 1
|
||||
|
|
@ -848,12 +846,13 @@ class UrlBase (object):
|
|||
name = line[5:]
|
||||
elif line.startswith("URL="):
|
||||
url = line[4:]
|
||||
if url:
|
||||
if url and name is not None:
|
||||
url_data = get_url_from(url, self.recursion_level+1,
|
||||
self.aggregate, parent_url=self.url,
|
||||
line=lineno, name=name)
|
||||
self.aggregate.urlqueue.put(url_data)
|
||||
name = ""
|
||||
else:
|
||||
name = None
|
||||
|
||||
def parse_text (self):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -62,6 +62,10 @@ class TestFile (LinkCheckTest):
|
|||
"""Test firefox 3 bookmark file parsing."""
|
||||
self.file_test("places.sqlite")
|
||||
|
||||
def test_opera_bookmarks (self):
|
||||
"""Test Opera bookmark file parsing."""
|
||||
self.file_test("opera6.adr")
|
||||
|
||||
def test_good_file (self):
|
||||
url = u"file://%(curdir)s/%(datadir)s/file.txt" % self.get_attrs()
|
||||
nurl = self.norm(url)
|
||||
|
|
|
|||
Loading…
Reference in a new issue