Use super simple HTTP codes to represent validation results

This commit is contained in:
Trever Fischer
2012-02-25 14:01:03 -05:00
parent 921f6c2661
commit 0d6056d168

View File

@@ -1,5 +1,6 @@
from piston.handler import AnonymousBaseHandler
from profiles.models import MinecraftProfile
from django.http import HttpResponse
class WhitelistHandler(AnonymousBaseHandler):
allowed_methods = ('GET',)
@@ -9,6 +10,7 @@ class WhitelistHandler(AnonymousBaseHandler):
try:
profile = MinecraftProfile.objects.get(mc_username__iexact=username)
except Exception, e:
return False
return profile.user.is_active
return False
return HttpResponse(status=403)
if profile.user.is_active:
return HttpResponse(status=204)
return HttpResponse(status=404)