You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
k4ever/k4ever/api2/handlers.py

38 lines
948 B

from piston.handler import BaseHandler
from piston.utils import rc
from k4ever.buyable.models import *
from k4ever.transaction.models import *
class BuyableItemHandler(BaseHandler):
allowed_methods = ('GET', 'POST')
#fields = ('id', 'description')
model = Buyable
exclude = ('_state',)
def read(self, request, itemId=None):
if itemId == None:
return Buyable.objects.all()
try:
return Buyable.objects.get(id=itemId)
except Buyable.DoesNotExist:
error = rc.NOT_FOUND
error.write("This buyable does not exist in our database")
return error
class BuyableTypeHandler(BaseHandler):
allowed_methods = ('GET',)
model = BuyableType
class TransactionTransactHandler(BaseHandler):
allowed_methods = ('GET', 'POST')
model = Transaction
class TransactionTypeHandler(BaseHandler):
allowed_methods = ('GET',)
model = TransactionType
class AuthBlobHandler(BaseHandler):
# allowed_methods = ('GET', 'POST')
# model =
pass