@ -94,9 +88,7 @@ class BuyableItemHandler(BaseHandler):
ifamount<1:
returnrc.BAD_REQUEST
ifamount>30:
ret=rc.BAD_REQUEST
ret.write("\nYou are trying to buy more than 30 items at once. This is not permitted. If you think it should, mail the admins / fix this in the handlers.py\n");
returnret
returngetError(rc.BAD_REQUEST,"You are trying to buy more than 30 items at once. This is not permitted. If you think it should, mail the admins / fix this in the handlers.py")
ret.write("\nYou need to specify either items or deposits (or both).\n")
returnret
returngetError(rc.BAD_REQUEST,"You need to specify either items or deposits (or both).")
ifnotrequest.data.has_key("items"):
request.data['items']=[]
@ -149,20 +137,13 @@ class BuyableItemHandler(BaseHandler):
raiseTypeError()
itemList+=request.data['deposits']
exceptTypeError:
ret=rc.BAD_REQUEST
ret.write("\nThe items/deposists parameter have to be a list.\n")
returnret
returngetError(rc.BAD_REQUEST,"The items/deposists parameter have to be a list.")
iflen(itemList)>30:
ret=rc.BAD_REQUEST
ret.write("\nYou are trying to buy more than 30 items at once. This is not permitted. If you think it should, mail the admins / fix this in the handlers.py\n");
returnret
returngetError(rc.BAD_REQUEST,"You are trying to buy more than 30 items at once. This is not permitted. If you think it should, mail the admins / fix this in the handlers.py")
iflen(itemList)==0:
ret=rc.BAD_REQUEST
ret.write("\nYour request contains no items/deposits.\n")
returnret
returngetError(rc.BAD_REQUEST,"Your request contains no items/deposits.")
ids={}
foriteminitemList:
@ -174,13 +155,9 @@ class BuyableItemHandler(BaseHandler):
ret.write("\nThe item with the id '%s' could not be found\n"%(item,))
returnret
exceptValueError:
ret=rc.NOT_FOUND
ret.write("\nItem ids should be numeric (and preferably integers)\n")
returnret
returngetError(rc.NOT_FOUND,"Item ids should be numeric (and preferably integers)")
ret.write("\nA negative amount (or zeroed) is not supported right now (there has not been put enough thought into the 'lending money' process\n")
returnret
returngetError(rc.BAD_REQUEST,"A negative amount (or zeroed) is not supported right now (there has not been put enough thought into the 'lending money' process")
tType=None
try:
tType=TransactionType.objects.get(id=tTypeId)
exceptTransactionType.DoesNotExist:
ret=rc.BAD_REQUEST
ret.write("\nYour TransactionType could not be found\n")
returnret
returngetError(rc.BAD_REQUEST,"Your TransactionType could not be found")
trans=Transaction()
trans.user=request.user
trans.transactionType=tType
@ -326,24 +303,18 @@ class TransactionVirtualHandler(BaseHandler):