Stop the AJAX return borking horribly

This commit is contained in:
2011-05-19 14:35:30 +01:00
parent 6f9749636c
commit 69324cf819

View File

@@ -74,7 +74,11 @@ def eveapi_refresh(request, userid, post_save_redirect='/'):
acc = task.wait(30) acc = task.wait(30)
except (celery.exceptions.TimeoutError, DocumentRetrievalError): except (celery.exceptions.TimeoutError, DocumentRetrievalError):
acc = EVEAccount.objects.get(id=userid) acc = EVEAccount.objects.get(id=userid)
return HttpResponse(serializers.serialize('json', [acc]), mimetype='application/javascript') if acc:
ret = [acc]
else:
ret = []
return HttpResponse(serializers.serialize('json', ret), mimetype='application/javascript')
else: else:
messages.add_message(request, messages.INFO, "Key %s has been queued to be refreshed from the API" % acc.api_user_id) messages.add_message(request, messages.INFO, "Key %s has been queued to be refreshed from the API" % acc.api_user_id)