praekelt/django-likes — pull request #7 by Rizziepit (2013-01-29 13:56:57+00:00)
Title: Hotfix/0.0.11

The django-secretballot middleware throws an error on all requests without a user agent (https://github.com/sunlightlabs/django-secretballot/issues/7). This floods logs with errors caused by bots. It would be ideal to implement a fix in django-secretballot.

For now, the django-likes middleware subclass generates a None token if there is no user agent instead of throwing an error. can_vote returns false if the token is None, resulting in a 403 response. Other apps that call the vote function directly will get an IntegrityError when saving the vote due to its token field being None.