From 71abc6ca66b4b5ad0e3cf774ccdfd93dac810604 Mon Sep 17 00:00:00 2001 From: Petr Baudis Date: Mon, 24 Sep 2012 03:52:36 +0200 Subject: [PATCH] brmbar.Shop.account_list(): New query method --- brmbar3/brmbar/Shop.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/brmbar3/brmbar/Shop.py b/brmbar3/brmbar/Shop.py index 2b7bf74..2716a11 100644 --- a/brmbar3/brmbar/Shop.py +++ b/brmbar3/brmbar/Shop.py @@ -94,3 +94,11 @@ class Shop: return balance def inventory_negbalance_str(self): return self.currency.str(-self.inventory_balance()) + + def account_list(self, acctype): + accts = [] + with closing(self.db.cursor()) as cur: + cur.execute("SELECT id FROM accounts WHERE acctype = %s", ["debt"]) + for inventory in cur: + accts += [ Account.load(self.db, id = inventory[0]) ] + return accts