diff --git a/planet/reconstitute.py b/planet/reconstitute.py index daaa314..6dc8ccc 100644 --- a/planet/reconstitute.py +++ b/planet/reconstitute.py @@ -103,6 +103,8 @@ def links(xentry, entry): xlink.setAttribute('type', link.get('type')) if link.has_key('rel'): xlink.setAttribute('rel', link.get('rel',None)) + if link.has_key('title'): + xlink.setAttribute('title', link.get('title')) if link.has_key('length'): xlink.setAttribute('length', link.get('length')) xentry.appendChild(xlink) @@ -229,15 +231,11 @@ def source(xsource, source, bozo, format): for contributor in source.get('contributors',[]): author(xsource, 'contributor', contributor) - links(xsource, source) if not source.has_key('links') and source.has_key('href'): #rss - xlink = xdoc.createElement('link') - xlink.setAttribute('href', source.get('href')) - xsource.appendChild(xlink) - if source.has_key('title'): - xtitle = xdoc.createElement('title') - xtitle.appendChild(xdoc.createTextNode(source.get('title'))) - xsource.appendChild(xtitle) + source['links'] = [{ 'href': source.get('href') }] + if source.has_key('title'): + source['links'][0]['title'] = source.get('title') + links(xsource, source) content(xsource, 'rights', source.get('rights_detail',None), bozo) content(xsource, 'subtitle', source.get('subtitle_detail',None), bozo) diff --git a/planet/splice.py b/planet/splice.py index db3bd3b..7738006 100644 --- a/planet/splice.py +++ b/planet/splice.py @@ -59,15 +59,16 @@ def splice(): if data.feed.has_key('id'): sub_ids.append(data.feed.id) if not data.feed: continue - for link in data.feed.links: - if link.rel == 'self': break - else: - log.warn('missing self link for ' + sub) + if not data.feed.has_key('planet_message'): + for link in data.feed.links: + if link.rel == 'self': break + else: + log.warn('missing self link for ' + sub) - for link in data.feed.links: - if link.rel == 'alternate' and 'html' in link.type: break - else: - log.warn('missing html link for ' + sub) + for link in data.feed.links: + if link.rel == 'alternate' and 'html' in link.type: break + else: + log.warn('missing html link for ' + sub) xdoc=minidom.parseString('''\n''' % planet.xmlns) diff --git a/tests/data/reconstitute/rss_source.xml b/tests/data/reconstitute/rss_source.xml index 6e26354..a00325c 100644 --- a/tests/data/reconstitute/rss_source.xml +++ b/tests/data/reconstitute/rss_source.xml @@ -1,6 +1,6 @@