Add a transfer capability and implante it in bp and boobank

Make a transfer in boobank like that:

>transfer fromaccountid toaccoundid amount

Signed-off-by: Nicolas Duhamel <nicolas@jombi.fr>
Signed-off-by: Romain Bignon <romain@peerfuse.org>
This commit is contained in:
Nicolas Duhamel 2010-09-24 18:07:06 +02:00 committed by Romain Bignon
commit 81706f23ad
4 changed files with 59 additions and 1 deletions

View file

@ -88,3 +88,25 @@ class Boobank(ReplApplication):
for backend, operation in self.do(do):
self.format(operation)
def do_transfer(self, arg):
"""
Make a transfer beetwen two account
"""
id_from , id_to, amount = arg.split()
id_from, backend_name = self.parse_id(id_from)
id_to, backend_name = self.parse_id(id_to)
names = (backend_name,) if backend_name is not None else None
self.load_backends(ICapBank, names=names)
def do(backend):
return backend.transfer(id_from, id_to, amount)
for backend, operation in self.do(do):
pass