def authenticate(self, request):
try:<EOL><INDENT>key = request.data['<STR_LIT>']<EOL><DEDENT>except KeyError:<EOL><INDENT>return<EOL><DEDENT>try:<EOL><INDENT>token = AuthToken.objects.get(key=key)<EOL><DEDENT>except AuthToken.DoesNotExist:<EOL><INDENT>return<EOL><DEDENT>return (token.user, token)<EOL>
Authenticate a user from a token form field

Errors thrown here will be swallowed by django-rest-framework, and it
expects us to return None if authentication fails.