Skip to content

Commit

Permalink
Fixed keyerror on form error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Sureiya committed Nov 18, 2013
1 parent 60ed80a commit 08fa085
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions django_clickbank/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,11 @@ def ipn(request, get=False):
except Exception, e:
raise NotificationFailedValidation(e)
else:
if form.errors['__all__'][0] == u'Notification with this Receipt and Transaction type already exists.':
notification = Notification.objects.get(receipt=form.data['receipt'])
logger.info('Notification recognized as duplicate. Returning OK.')
return HttpResponse(notification.id)
if '__all__' in form.errors:
if form.errors['__all__'][0] == u'Notification with this Receipt and Transaction type already exists.':
notification = Notification.objects.get(receipt=form.data['receipt'])
logger.info('Notification recognized as duplicate. Returning OK.')
return HttpResponse(notification.id)

raise NotificationFailedValidation('{0}\n{1}\n{2}'.format(form.errors, mapped_data, data))

Expand Down
Empty file modified setup.py
100644 → 100755
Empty file.

0 comments on commit 08fa085

Please sign in to comment.