mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-04-28 18:14:42 +00:00
basic is_extern method
git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@1999 e7d03fd6-7b0d-0410-9947-9c21f3af8025
This commit is contained in:
parent
74f1935be5
commit
4014012c1f
1 changed files with 15 additions and 13 deletions
|
|
@ -246,7 +246,7 @@ class UrlBase (object):
|
|||
self.set_result(str(msg), valid=False)
|
||||
return False
|
||||
self.set_cache_keys()
|
||||
self.extern = self._get_extern()
|
||||
self.extern = self._get_extern(self.url)
|
||||
return True
|
||||
|
||||
def build_url (self):
|
||||
|
|
@ -322,12 +322,8 @@ class UrlBase (object):
|
|||
self.consumer.config['wait'])
|
||||
time.sleep(self.consumer.config['wait'])
|
||||
t = time.time()
|
||||
# apply filter
|
||||
linkcheck.log.debug(linkcheck.LOG_CHECK, "extern=%s", self.extern)
|
||||
if self.extern[0] and \
|
||||
(self.consumer.config["externstrictall"] or self.extern[1]):
|
||||
self.add_info(
|
||||
_("outside of domain filter, checked only syntax"))
|
||||
if self.is_extern():
|
||||
self.add_info(_("outside of domain filter, checked only syntax"))
|
||||
return
|
||||
|
||||
# check connection
|
||||
|
|
@ -450,24 +446,30 @@ class UrlBase (object):
|
|||
return
|
||||
self.add_warning(_("anchor #%s not found") % self.anchor)
|
||||
|
||||
def _get_extern (self):
|
||||
def is_extern (self):
|
||||
# apply filter
|
||||
linkcheck.log.debug(linkcheck.LOG_CHECK, "extern=%s", self.extern)
|
||||
return self.extern[0] and \
|
||||
(self.consumer.config["externstrictall"] or self.extern[1])
|
||||
|
||||
def _get_extern (self, url):
|
||||
if not (self.consumer.config["externlinks"] or \
|
||||
self.consumer.config["internlinks"]):
|
||||
return (0, 0)
|
||||
# deny and allow external checking
|
||||
linkcheck.log.debug(linkcheck.LOG_CHECK, "Url %r", self.url)
|
||||
linkcheck.log.debug(linkcheck.LOG_CHECK, "Url %r", url)
|
||||
if self.consumer.config["denyallow"]:
|
||||
for entry in self.consumer.config["externlinks"]:
|
||||
linkcheck.log.debug(linkcheck.LOG_CHECK, "Extern entry %r",
|
||||
entry)
|
||||
match = entry['pattern'].search(self.url)
|
||||
match = entry['pattern'].search(url)
|
||||
if (entry['negate'] and not match) or \
|
||||
(match and not entry['negate']):
|
||||
return (1, entry['strict'])
|
||||
for entry in self.consumer.config["internlinks"]:
|
||||
linkcheck.log.debug(linkcheck.LOG_CHECK, "Intern entry %r",
|
||||
entry)
|
||||
match = entry['pattern'].search(self.url)
|
||||
match = entry['pattern'].search(url)
|
||||
if (entry['negate'] and not match) or \
|
||||
(match and not entry['negate']):
|
||||
return (0, 0)
|
||||
|
|
@ -476,14 +478,14 @@ class UrlBase (object):
|
|||
for entry in self.consumer.config["internlinks"]:
|
||||
linkcheck.log.debug(linkcheck.LOG_CHECK, "Intern entry %r",
|
||||
entry)
|
||||
match = entry['pattern'].search(self.url)
|
||||
match = entry['pattern'].search(url)
|
||||
if (entry['negate'] and not match) or \
|
||||
(match and not entry['negate']):
|
||||
return (0, 0)
|
||||
for entry in self.consumer.config["externlinks"]:
|
||||
linkcheck.log.debug(linkcheck.LOG_CHECK, "Extern entry %r",
|
||||
entry)
|
||||
match = entry['pattern'].search(self.url)
|
||||
match = entry['pattern'].search(url)
|
||||
if (entry['negate'] and not match) or \
|
||||
(match and not entry['negate']):
|
||||
return (1, entry['strict'])
|
||||
|
|
|
|||
Loading…
Reference in a new issue