"redirect" and "url" in cache to control end url
Allow redirection, while keeping the same cache objectmaster
parent
6c72a6e583
commit
4ece739722
13
morss.py
13
morss.py
|
@ -423,6 +423,15 @@ def Gather(url, cachePath, options):
|
||||||
|
|
||||||
log(cache._hash)
|
log(cache._hash)
|
||||||
|
|
||||||
|
if 'redirect' in cache:
|
||||||
|
url = cache.get('redirect')
|
||||||
|
log('url redirect')
|
||||||
|
log(url)
|
||||||
|
|
||||||
|
if 'cache' in cache:
|
||||||
|
cache.redirect(cache.get('cache'))
|
||||||
|
log('cache redirect')
|
||||||
|
|
||||||
# fetch feed
|
# fetch feed
|
||||||
if cache.isYoungerThan(DELAY) and not options.theforce and 'xml' in cache and 'style' in cache:
|
if cache.isYoungerThan(DELAY) and not options.theforce and 'xml' in cache and 'style' in cache:
|
||||||
log('xml cached')
|
log('xml cached')
|
||||||
|
@ -430,10 +439,6 @@ def Gather(url, cachePath, options):
|
||||||
style = cache.get('style')
|
style = cache.get('style')
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
if 'redirect' in cache:
|
|
||||||
url = cache.get('redirect')
|
|
||||||
log(url)
|
|
||||||
|
|
||||||
opener = SimpleDownload(cache.get(url), cache.get('etag'), cache.get('lastmodified'), decode=False)
|
opener = SimpleDownload(cache.get(url), cache.get('etag'), cache.get('lastmodified'), decode=False)
|
||||||
con = urllib2.build_opener(opener).open(url, timeout=TIMEOUT)
|
con = urllib2.build_opener(opener).open(url, timeout=TIMEOUT)
|
||||||
xml = con.read()
|
xml = con.read()
|
||||||
|
|
Loading…
Reference in New Issue