From 6a71841112c446a2ab639ef8b6a79e47e6163d24 Mon Sep 17 00:00:00 2001 From: Petr Baudis Date: Fri, 28 Sep 2012 23:28:18 +0200 Subject: [PATCH] brmbarv3: Add missing db.commit() at two places --- brmbar3/brmbar-gui-qt4.py | 2 ++ brmbar3/brmbar/Account.py | 1 + 2 files changed, 3 insertions(+) diff --git a/brmbar3/brmbar-gui-qt4.py b/brmbar3/brmbar-gui-qt4.py index 9198720..e88ba42 100755 --- a/brmbar3/brmbar-gui-qt4.py +++ b/brmbar3/brmbar-gui-qt4.py @@ -119,6 +119,8 @@ class ShopAdapter(QtCore.QObject): cost = "" if (acct.balance() < int(invmap["balance"])): cost = shop.buy_for_cash(acct, invmap["balance"] - acct.balance()) + else: + db.commit() return { "dbid": dbid, "cost": (currency.str(cost) if cost != "" else "") } @QtCore.Slot('QVariant', result='QVariant') diff --git a/brmbar3/brmbar/Account.py b/brmbar3/brmbar/Account.py index c6b236b..e9107eb 100644 --- a/brmbar3/brmbar/Account.py +++ b/brmbar3/brmbar/Account.py @@ -82,6 +82,7 @@ class Account: def add_barcode(self, barcode): with closing(self.db.cursor()) as cur: cur.execute("INSERT INTO barcodes (account, barcode) VALUES (%s, %s)", [self.id, barcode]) + self.db.commit() def rename(self, name): with closing(self.db.cursor()) as cur: