From 4ece739722c07dd1017828eb950424af27029dde Mon Sep 17 00:00:00 2001 From: pictuga Date: Sat, 9 Nov 2013 18:40:23 +0100 Subject: [PATCH] "redirect" and "url" in cache to control end url Allow redirection, while keeping the same cache object --- morss.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/morss.py b/morss.py index d20f6c1..8cf6b1a 100644 --- a/morss.py +++ b/morss.py @@ -423,6 +423,15 @@ def Gather(url, cachePath, options): 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 if cache.isYoungerThan(DELAY) and not options.theforce and 'xml' in cache and 'style' in cache: log('xml cached') @@ -430,10 +439,6 @@ def Gather(url, cachePath, options): style = cache.get('style') else: try: - if 'redirect' in cache: - url = cache.get('redirect') - log(url) - opener = SimpleDownload(cache.get(url), cache.get('etag'), cache.get('lastmodified'), decode=False) con = urllib2.build_opener(opener).open(url, timeout=TIMEOUT) xml = con.read()