forked from brmlab/brmbar-github
Moar transfer logging.
This commit is contained in:
parent
afb5476c2d
commit
ff68817129
2 changed files with 8 additions and 3 deletions
|
@ -150,11 +150,16 @@ class ShopAdapter(QtCore.QObject):
|
||||||
|
|
||||||
@QtCore.Slot('QVariant', 'QVariant', 'QVariant', result='QVariant')
|
@QtCore.Slot('QVariant', 'QVariant', 'QVariant', result='QVariant')
|
||||||
def newTransfer(self, uidfrom, uidto, amount):
|
def newTransfer(self, uidfrom, uidto, amount):
|
||||||
|
logger.debug("newTransfer %s %s %s", uidfrom, uidto, amount)
|
||||||
ufrom = brmbar.Account.load(db, id=uidfrom)
|
ufrom = brmbar.Account.load(db, id=uidfrom)
|
||||||
|
logger.debug(" ufrom = %s", ufrom)
|
||||||
uto = brmbar.Account.load(db, id=uidto)
|
uto = brmbar.Account.load(db, id=uidto)
|
||||||
|
logger.debug(" uto = %s", uto)
|
||||||
shop.transfer_credit(ufrom, uto, amount = amount)
|
shop.transfer_credit(ufrom, uto, amount = amount)
|
||||||
db.commit()
|
db.commit()
|
||||||
return currency.str(float(amount))
|
csfa = currency.str(float(amount))
|
||||||
|
logger.debug(" csfa = '%s'", csfa)
|
||||||
|
return csfa
|
||||||
|
|
||||||
@QtCore.Slot('QVariant', result='QVariant')
|
@QtCore.Slot('QVariant', result='QVariant')
|
||||||
def balance_user(self, userid):
|
def balance_user(self, userid):
|
||||||
|
|
|
@ -39,13 +39,13 @@ class Database:
|
||||||
cur.execute(query, attrs)
|
cur.execute(query, attrs)
|
||||||
return cur
|
return cur
|
||||||
except psycopg2.DataError as error: # when biitr comes and enters '99999999999999999999' for amount
|
except psycopg2.DataError as error: # when biitr comes and enters '99999999999999999999' for amount
|
||||||
print("We have invalid input data (SQLi?): level %s (%s) @%s" % (
|
logger.debug("We have invalid input data (SQLi?): level %s (%s) @%s" % (
|
||||||
level, error, time.strftime("%Y%m%d %a %I:%m %p")
|
level, error, time.strftime("%Y%m%d %a %I:%m %p")
|
||||||
))
|
))
|
||||||
self.db_conn.rollback()
|
self.db_conn.rollback()
|
||||||
raise RuntimeError("Unsanitized data entered again... BOBBY TABLES")
|
raise RuntimeError("Unsanitized data entered again... BOBBY TABLES")
|
||||||
except psycopg2.OperationalError as error:
|
except psycopg2.OperationalError as error:
|
||||||
print("Sleeping: level %s (%s) @%s" % (
|
logger.debug("Sleeping: level %s (%s) @%s" % (
|
||||||
level, error, time.strftime("%Y%m%d %a %I:%m %p")
|
level, error, time.strftime("%Y%m%d %a %I:%m %p")
|
||||||
))
|
))
|
||||||
#TODO: emit message "db conn failed, reconnecting
|
#TODO: emit message "db conn failed, reconnecting
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue