Safety first: ensure links exists before testing

This commit is contained in:
Sam Ruby 2010-05-20 17:29:46 -04:00
parent d2f2f8510b
commit f6e588550f

View File

@ -59,16 +59,19 @@ def splice():
if data.feed.has_key('id'): sub_ids.append(data.feed.id)
if not data.feed: continue
# warn on missing links
if not data.feed.has_key('planet_message'):
if not data.has_key('links'): data.feed['links'] = []
for link in data.feed.links:
if link.rel == 'self': break
else:
log.warn('missing self link for ' + sub)
log.debug('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)
log.debug('missing html link for ' + sub)
xdoc=minidom.parseString('''<planet:source xmlns:planet="%s"
xmlns="http://www.w3.org/2005/Atom"/>\n''' % planet.xmlns)