diff --git a/planet/shell/tmpl.py b/planet/shell/tmpl.py index 63cc5db..81a79d5 100644 --- a/planet/shell/tmpl.py +++ b/planet/shell/tmpl.py @@ -80,6 +80,7 @@ Base = [ ['title', String, 'title_detail', 'value'], ['title_plain', Plain, 'title_detail', 'value'], ['url', String, 'links', {'rel':'self'}, 'href'], + ['url', String, 'planet_http_location'], ] Items = [ diff --git a/planet/spider.py b/planet/spider.py index 97658c9..87271e6 100644 --- a/planet/spider.py +++ b/planet/spider.py @@ -128,7 +128,9 @@ def spiderFeed(feed): # process based on the HTTP status code log = planet.logger - if data.status == 301 and data.has_key("entries") and len(data.entries)>0: + if data.status == 200 and data.has_key("url"): + data.feed['planet_http_location'] = data.url + elif data.status == 301 and data.has_key("entries") and len(data.entries)>0: log.warning("Feed has moved from <%s> to <%s>", feed, data.url) data.feed['planet_http_location'] = data.url elif data.status == 304: @@ -194,14 +196,6 @@ def spiderFeed(feed): # perform user configured scrub operations on the data scrub(feed, data) - # write the feed info to the cache - if not os.path.exists(sources): os.makedirs(sources) - xdoc=minidom.parseString('''\n''' % planet.xmlns) - reconstitute.source(xdoc.documentElement, data.feed, data.bozo) - write(xdoc.toxml('utf-8'), filename(sources, feed)) - xdoc.unlink() - # write each entry to the cache cache = config.cache_directory() for entry in data.entries: @@ -240,6 +234,14 @@ def spiderFeed(feed): write(output, cache_file) os.utime(cache_file, (mtime, mtime)) + # write the feed info to the cache + if not os.path.exists(sources): os.makedirs(sources) + xdoc=minidom.parseString('''\n''' % planet.xmlns) + reconstitute.source(xdoc.documentElement, data.feed, data.bozo) + write(xdoc.toxml('utf-8'), filename(sources, feed)) + xdoc.unlink() + def spiderPlanet(): """ Spider (fetch) an entire planet """ log = planet.getLogger(config.log_level()) diff --git a/themes/asf/index.html.xslt b/themes/asf/index.html.xslt index e314ab1..abe6e38 100644 --- a/themes/asf/index.html.xslt +++ b/themes/asf/index.html.xslt @@ -37,9 +37,24 @@
  • - + + + + + + + + + + + + + + (feed) + +