move self.is_cache(), and use urlunsplit to set self.url

git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@1499 e7d03fd6-7b0d-0410-9947-9c21f3af8025
This commit is contained in:
calvin 2004-08-25 19:50:40 +00:00
parent d0b54018ee
commit c904caa5c5

View file

@ -190,21 +190,21 @@ class UrlBase (object):
return []
return [key]
def is_cached (self):
return self.consumer.cache.url_is_cached(self.get_cache_key())
def get_cache_key (self):
"""Get key to store this url data in the cache."""
assert self.anchor is not None
if self.urlparts:
if self.consumer.config["anchorcaching"]:
# do not ignore anchor
return urlparse.urlunsplit(self.urlparts)
return self.url
else:
# removed anchor from cache key
return urlparse.urlunsplit(self.urlparts[:4]+[''])
return None
def is_cached (self):
return self.consumer.cache.url_is_cached(self.get_cache_key())
def build_url (self):
# make url absolute
if self.base_ref:
@ -220,6 +220,8 @@ class UrlBase (object):
self.url = self.base_url
# split into (modifiable) list
self.urlparts = list(urlparse.urlsplit(self.url))
# and unsplit again
self.url = urlparse.urlunsplit(self.urlparts)
# check userinfo@host:port syntax
self.userinfo, host = urllib.splituser(self.urlparts[1])
# set host lowercase and without userinfo