API: Added more JSON with success msgs to api

This commit is contained in:
Sebastian Lohff 2012-01-21 22:01:31 +01:00
parent 018332e16d
commit 67f5b43c72
1 changed files with 6 additions and 6 deletions

View File

@ -116,8 +116,8 @@ class BuyableItemHandler(BaseHandler):
p.save(saveOrder=False) p.save(saveOrder=False)
order.save() order.save()
return rc.CREATED return {'success': True, 'balance': request.user.getProfile().balance}
def bulkBuy(self, request): def bulkBuy(self, request):
"""Buy a :class:`Buyable <buyable.models.Buyable>` item. """Buy a :class:`Buyable <buyable.models.Buyable>` item.
@ -179,7 +179,7 @@ class BuyableItemHandler(BaseHandler):
p.save(saveOrder=False) p.save(saveOrder=False)
order.save() order.save()
return rc.CREATED return {'success': True, 'balance': request.user.getProfile().balance}
class BuyableTypeHandler(BaseHandler): class BuyableTypeHandler(BaseHandler):
@ -290,7 +290,7 @@ class TransactionTransactHandler(BaseHandler):
return getError(rc.BAD_REQUEST, "Your TransactionType could not be found") return getError(rc.BAD_REQUEST, "Your TransactionType could not be found")
trans = Transaction(user=request.user, transactionType=tType, amount=amount, checked=not tType.needsCheck) trans = Transaction(user=request.user, transactionType=tType, amount=amount, checked=not tType.needsCheck)
trans.save() trans.save()
return rc.ALL_OK return {'success': True, 'balance': request.user.getProfile().balance}
class TransactionTypeHandler(BaseHandler): class TransactionTypeHandler(BaseHandler):
"""Handler for :class:`Transaction Types <transaction.models.TransactionType>` """Handler for :class:`Transaction Types <transaction.models.TransactionType>`
@ -348,7 +348,7 @@ class TransactionVirtualHandler(BaseHandler):
return getError(rc.BAD_REQUEST, "The recipient user does not exist.") return getError(rc.BAD_REQUEST, "The recipient user does not exist.")
trans = VirtualTransaction(user=request.user, recipient=recipient, amount=amount, comment=comment) trans = VirtualTransaction(user=request.user, recipient=recipient, amount=amount, comment=comment)
trans.save() trans.save()
return rc.ALL_OK return {'success': True, 'balance': request.user.getProfile().balance}
class AccountBalanceHandler(BaseHandler): class AccountBalanceHandler(BaseHandler):
"""Handler for the user's account balance""" """Handler for the user's account balance"""
@ -402,7 +402,7 @@ class AuthBlobHandler(BaseHandler):
request.pluginperms.authblob = request.data['authblob'] request.pluginperms.authblob = request.data['authblob']
request.pluginperms.authblob.save() request.pluginperms.authblob.save()
return rc.ALL_OK return {'success': True}
class AuthUserHandler(BaseHandler): class AuthUserHandler(BaseHandler):
""" Handler for mapping an authblob to a user """ Handler for mapping an authblob to a user