Hand: Throw error when Draw hand has no deal section

Resolves: https://sourceforge.net/apps/mantisbt/fpdb/view.php?id=76
This commit is contained in:
Worros 2011-01-25 13:10:50 +08:00
parent 5a30d793c7
commit 341f5198b8

View File

@ -349,15 +349,13 @@ db: a connected Database object"""
# Need to find MySQL and Postgres equivalents # Need to find MySQL and Postgres equivalents
# MySQL maybe: cursorclass=MySQLdb.cursors.DictCursor # MySQL maybe: cursorclass=MySQLdb.cursors.DictCursor
res = c.fetchone() res = c.fetchone()
#res['tourneyId'] #res['seats'] #res['rush']
self.tablename = res['tableName'] self.tablename = res['tableName']
self.handid = res['siteHandNo'] self.handid = res['siteHandNo']
self.startTime = datetime.datetime.strptime(res['startTime'], "%Y-%m-%d %H:%M:%S+00:00") self.startTime = datetime.datetime.strptime(res['startTime'], "%Y-%m-%d %H:%M:%S+00:00")
#res['tourneyId']
#gametypeId
#res['importTime'] # Don't really care about this
#res['seats']
self.maxseats = res['maxSeats'] self.maxseats = res['maxSeats']
#res['rush']
cards = map(Card.valueSuitFromCard, [res['boardcard1'], res['boardcard2'], res['boardcard3'], res['boardcard4'], res['boardcard5']]) cards = map(Card.valueSuitFromCard, [res['boardcard1'], res['boardcard2'], res['boardcard3'], res['boardcard4'], res['boardcard5']])
#print "DEBUG: res['boardcard1']: %s" % res['boardcard1'] #print "DEBUG: res['boardcard1']: %s" % res['boardcard1']
#print "DEBUG: cards: %s" % cards #print "DEBUG: cards: %s" % cards
@ -1140,6 +1138,9 @@ class DrawHand(Hand):
hhc.readPlayerStacks(self) hhc.readPlayerStacks(self)
hhc.compilePlayerRegexs(self) hhc.compilePlayerRegexs(self)
hhc.markStreets(self) hhc.markStreets(self)
# markStreets in Draw may match without dealing cards
if self.streets['DEAL'] == None:
raise FpdbParseError(_("DrawHand.__init__: street 'DEAL' is empty. Hand cancelled?"))
hhc.readBlinds(self) hhc.readBlinds(self)
hhc.readAntes(self) hhc.readAntes(self)
hhc.readButton(self) hhc.readButton(self)