mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-14 14:52:15 +00:00
Check for value errors, removed uneeded import line.
This commit is contained in:
@@ -3,7 +3,6 @@ from datetime import datetime
|
|||||||
from xml.dom import minidom
|
from xml.dom import minidom
|
||||||
from operator import itemgetter
|
from operator import itemgetter
|
||||||
|
|
||||||
from django.contrib.auth import login, logout, authenticate
|
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
|
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
@@ -149,7 +148,10 @@ class EveAPIProxyHandler(BaseHandler):
|
|||||||
params[key.lower()] = value
|
params[key.lower()] = value
|
||||||
|
|
||||||
if 'userid' in params or 'keyid' in params:
|
if 'userid' in params or 'keyid' in params:
|
||||||
obj = get_object_or_404(EVEAccount, pk=params['userid'])
|
try:
|
||||||
|
obj = get_object_or_404(EVEAccount, pk=params['userid'])
|
||||||
|
except ValueError:
|
||||||
|
return rc.BAD_REQUEST
|
||||||
|
|
||||||
# "Fix" new style keys
|
# "Fix" new style keys
|
||||||
if obj.api_keytype >= 3:
|
if obj.api_keytype >= 3:
|
||||||
@@ -162,7 +164,7 @@ class EveAPIProxyHandler(BaseHandler):
|
|||||||
try:
|
try:
|
||||||
cached_doc = CachedDocument.objects.api_query(url_path, params, service=request.api_key.name)
|
cached_doc = CachedDocument.objects.api_query(url_path, params, service=request.api_key.name)
|
||||||
except DocumentRetrievalError, exc:
|
except DocumentRetrievalError, exc:
|
||||||
return HttpResponse(exc, status=500)
|
return rc.INTERNAL_ERROR
|
||||||
else:
|
else:
|
||||||
return HttpResponse(cached_doc.body)
|
return HttpResponse(cached_doc.body)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user