Stars: Minor refactor to readHandInfo

Make the readHandInfo function throw an exception if either of the regexes used fails to match
This commit is contained in:
Worros 2010-08-27 14:44:19 +08:00
parent 6b978b8290
commit de9c0d9ba6

View File

@ -225,13 +225,14 @@ class PokerStars(HandHistoryConverter):
def readHandInfo(self, hand): def readHandInfo(self, hand):
info = {} info = {}
m = self.re_HandInfo.search(hand.handText,re.DOTALL) m = self.re_HandInfo.search(hand.handText,re.DOTALL)
if m: m2 = self.re_GameInfo.search(hand.handText)
info.update(m.groupdict()) if m is None or m2 is None:
else: logging.info("Didn't match re_HandInfo")
pass # throw an exception here, eh? logging.info(hand.handText)
m = self.re_GameInfo.search(hand.handText) raise FpdbParseError("No match in readHandInfo.")
if m:
info.update(m.groupdict()) info.update(m.groupdict())
info.update(m2.groupdict())
log.debug("readHandInfo: %s" % info) log.debug("readHandInfo: %s" % info)
for key in info: for key in info: