reflow init_hud_stat_vars exception handling
This commit is contained in:
parent
d6c5309aa3
commit
a1783a37cb
|
@ -370,23 +370,20 @@ class Database:
|
|||
def init_hud_stat_vars(self, hud_days):
|
||||
"""Initialise variables used by Hud to fetch stats."""
|
||||
|
||||
try:
|
||||
# self.hand_1day_ago used to fetch stats for current session (i.e. if hud_style = 'S')
|
||||
self.hand_1day_ago = 1
|
||||
try:
|
||||
c = self.get_cursor()
|
||||
c.execute(self.sql.query['get_hand_1day_ago'])
|
||||
row = c.fetchone()
|
||||
except: # TODO: what error is a database error?!
|
||||
err = traceback.extract_tb(sys.exc_info()[2])[-1]
|
||||
print "*** Error: " + err[2] + "(" + str(err[1]) + "): " + str(sys.exc_info()[1])
|
||||
else:
|
||||
if row and row[0]:
|
||||
self.hand_1day_ago = row[0]
|
||||
#print "hand 1day ago =", self.hand_1day_ago
|
||||
|
||||
# self.date_ndays_ago used if hud_style = 'T'
|
||||
self.hand_1_day_ago = row[0]
|
||||
d = timedelta(days=hud_days)
|
||||
now = datetime.utcnow() - d
|
||||
self.date_ndays_ago = "d%02d%02d%02d" % (now.year-2000, now.month, now.day)
|
||||
except:
|
||||
err = traceback.extract_tb(sys.exc_info()[2])[-1]
|
||||
print "***Error: "+err[2]+"("+str(err[1])+"): "+str(sys.exc_info()[1])
|
||||
self.date_ndays_ago = "d%02d%02d%02d" % (now.year - 2000, now.month, now.day)
|
||||
|
||||
def init_player_hud_stat_vars(self, playerid):
|
||||
# not sure if this is workable, to be continued ...
|
||||
|
|
Loading…
Reference in New Issue
Block a user