Permalink
Browse files

Safety first: ensure links exists before testing

  • Loading branch information...
1 parent d2f2f85 commit f6e588550fc59bfd75686139d1f592fda64d6c23 @rubys committed May 20, 2010
Showing with 5 additions and 2 deletions.
  1. +5 −2 planet/splice.py
View
@@ -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'] = []
@mbrubeck

mbrubeck May 21, 2010

Contributor

Shouldn't this be "if not data**.feed**.has_key('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)

0 comments on commit f6e5885

Please sign in to comment.