Skip to content

Commit

Permalink
Handling for malformed notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Dietz committed Jan 6, 2012
1 parent 0b0d5b9 commit 6f46a3f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
10 changes: 7 additions & 3 deletions yagi/notifier/atompub.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,13 @@ def notify(notifications):
conn.add_credentials(auth_user, auth_key)

for notification in notifications:
entity = dict(content=notification,
id=notification['id'],
event_type=notification['event_type'])
try:
entity = dict(content=notification,
id=notification['id'],
event_type=notification['event_type'])
except KeyError, e:
LOG.error('Malformed Notification: %s' % notification)
LOG.exception(e)
notification_body = yagi.serializer.atom.dump_item(entity)

conn.follow_all_redirects = True
Expand Down
10 changes: 7 additions & 3 deletions yagi/notifier/pubsubhubbub.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,13 @@ def notify(notifications):
topics = {}
# Compile the list of updated topic urls
for notification in notifications:
event_type = notification['event_type']
if not event_type in topics:
topics[event_type] = topic_url(event_type)
try:
event_type = notification['event_type']
if not event_type in topics:
topics[event_type] = topic_url(event_type)
except KeyError, e:
LOG.error('Malformed Notification: %s' % notification)
LOG.exception(e)

for event_type, topic in topics.iteritems():
try:
Expand Down

0 comments on commit 6f46a3f

Please sign in to comment.