mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-03-22 17:00:25 +00:00
python 2.0 fix
git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@224 e7d03fd6-7b0d-0410-9947-9c21f3af8025
This commit is contained in:
parent
af22738035
commit
a2ceebf3eb
5 changed files with 32 additions and 19 deletions
6
debian/changelog
vendored
6
debian/changelog
vendored
|
|
@ -1,3 +1,9 @@
|
|||
linkchecker (1.2.14) unstable; urgency=low
|
||||
|
||||
* fixed Python 2.0 bug: TypeError: object has read-only attributes
|
||||
|
||||
-- Bastian Kleineidam <calvin@users.sourceforge.net> Thu, 11 Jan 2001 21:29:00 +0100
|
||||
|
||||
linkchecker (1.2.13) unstable; urgency=low
|
||||
|
||||
* linkcheck/HttpUrlData.py:
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
""" linkcheck/Config.py
|
||||
|
||||
Copyright (C) 2000 Bastian Kleineidam
|
||||
Copyright (C) 2000,2001 Bastian Kleineidam
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -35,8 +35,8 @@ App = AppName+" "+Version
|
|||
UserAgent = AppName+"/"+Version
|
||||
Author = LinkCheckerConf.author
|
||||
HtmlAuthor = string.replace(Author, ' ', ' ')
|
||||
Copyright = "Copyright © 2000 by "+Author
|
||||
HtmlCopyright = "Copyright © 2000 by "+HtmlAuthor
|
||||
Copyright = "Copyright © 2000,2001 by "+Author
|
||||
HtmlCopyright = "Copyright © 2000,2001 by "+HtmlAuthor
|
||||
AppInfo = App+" "+Copyright
|
||||
HtmlAppInfo = App+", "+HtmlCopyright
|
||||
Url = LinkCheckerConf.url
|
||||
|
|
|
|||
|
|
@ -66,10 +66,22 @@ LinkTags = (
|
|||
|
||||
LinkPatterns = []
|
||||
for tag,attr in LinkTags:
|
||||
pattern = re.compile(_linkMatcher % (tag, attr), re.VERBOSE)
|
||||
pattern.tag = tag
|
||||
pattern.attr = attr
|
||||
LinkPatterns.append(pattern)
|
||||
LinkPatterns.append({'pattern': re.compile(_linkMatcher % (tag, attr),
|
||||
re.VERBOSE),
|
||||
'tag': tag,
|
||||
'attr': attr})
|
||||
AnchorPattern = {
|
||||
'pattern': re.compile(_linkMatcher % ("a", "name"), re.VERBOSE),
|
||||
'tag': 'a',
|
||||
'attr': 'name',
|
||||
}
|
||||
|
||||
BasePattern = {
|
||||
'pattern': re.compile(_linkMatcher % ("base", "href"), re.VERBOSE),
|
||||
'tag': 'base',
|
||||
'attr': 'href',
|
||||
}
|
||||
|
||||
|
||||
class UrlData:
|
||||
"Representing a URL with additional information like validity etc"
|
||||
|
|
@ -260,10 +272,7 @@ class UrlData:
|
|||
if not (anchor!="" and self.isHtml() and self.valid):
|
||||
return
|
||||
self.getContent()
|
||||
pattern = re.compile(_linkMatcher % ("a", "name"), re.VERBOSE)
|
||||
pattern.tag = "a"
|
||||
pattern.attr = "name"
|
||||
for cur_anchor,line in self.searchInForTag(pattern):
|
||||
for cur_anchor,line in self.searchInForTag(AnchorPattern):
|
||||
if cur_anchor == anchor:
|
||||
return
|
||||
self.setWarning("anchor #"+anchor+" not found")
|
||||
|
|
@ -331,10 +340,7 @@ class UrlData:
|
|||
debug(Config.DebugDelim+"Parsing recursively into\n"+\
|
||||
str(self)+"\n"+Config.DebugDelim)
|
||||
# search for a possible base reference
|
||||
pattern = re.compile(_linkMatcher % ("base", "href"), re.VERBOSE)
|
||||
pattern.tag = "base"
|
||||
pattern.attr = "href"
|
||||
bases = self.searchInForTag(pattern)
|
||||
bases = self.searchInForTag(BasePattern)
|
||||
|
||||
baseRef = None
|
||||
if len(bases)>=1:
|
||||
|
|
@ -352,11 +358,11 @@ class UrlData:
|
|||
|
||||
def searchInForTag(self, pattern):
|
||||
debug("Searching for tag %s, attribute %s" \
|
||||
% (pattern.tag, pattern.attr))
|
||||
% (pattern['tag'], pattern['attr']))
|
||||
urls = []
|
||||
index = 0
|
||||
while 1:
|
||||
match = pattern.search(self.getContent(), index)
|
||||
match = pattern['pattern'].search(self.getContent(), index)
|
||||
if not match: break
|
||||
index = match.end()
|
||||
if self._isInComment(match.start()): continue
|
||||
|
|
@ -364,7 +370,7 @@ class UrlData:
|
|||
url = string.strip(StringUtil.stripQuotes(match.group('value')))
|
||||
lineno=StringUtil.getLineNumber(self.getContent(), match.start())
|
||||
# extra feature: get optional name for this bookmark
|
||||
name = self.searchInForName(pattern.tag, pattern.attr,
|
||||
name = self.searchInForName(pattern['tag'], pattern['attr'],
|
||||
match.start(), match.end())
|
||||
urls.append((url, lineno, name))
|
||||
return urls
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@
|
|||
#filename=linkchecker-out.ansi
|
||||
#colorparent=
|
||||
#colorurl=
|
||||
#colorname=
|
||||
#colorreal=
|
||||
#colorbase=
|
||||
#colorvalid=
|
||||
|
|
|
|||
2
setup.py
2
setup.py
|
|
@ -215,7 +215,7 @@ myname = "Bastian Kleineidam"
|
|||
myemail = "calvin@users.sourceforge.net"
|
||||
|
||||
setup (name = "LinkChecker",
|
||||
version = "1.2.13",
|
||||
version = "1.2.14",
|
||||
description = "check HTML documents for broken links",
|
||||
author = myname,
|
||||
author_email = myemail,
|
||||
|
|
|
|||
Loading…
Reference in a new issue