Merge branch 'master' of git://git.assembla.com/fpdb-eric

This commit is contained in:
Mika Bostrom 2009-10-10 09:22:19 +03:00
commit e1cc4d59eb
4 changed files with 10 additions and 4 deletions

View File

@ -107,7 +107,7 @@ class DerivedStats():
self.hands['playersVpi'] = len(vpipers)
def playersAtStreetX(self, hand):
"""playersAtStreet1 SMALLINT NOT NULL, /* num of players seeing flop/street4/draw1 */"""
""" playersAtStreet1 SMALLINT NOT NULL, /* num of players seeing flop/street4/draw1 */"""
# self.actions[street] is a list of all actions in a tuple, contining the player name first
# [ (player, action, ....), (player2, action, ...) ]
# The number of unique players in the list per street gives the value for playersAtStreetXXX
@ -145,7 +145,7 @@ class DerivedStats():
# [ (player, action, ....), (player2, action, ...) ]
# No idea what this value is actually supposed to be
# In theory its "num small bets paid to see flop/street4, including blind" which makes sense for limit. Not so useful for nl
pass
def aggr(self, hand, i):
aggrers = set()

View File

@ -17,5 +17,8 @@ class FpdbParseError(FpdbError):
class FpdbDatabaseError(FpdbError):
pass
class FpdbMySQLFailedError(FpdbDatabaseError):
pass
class DuplicateError(FpdbError):
pass

5
pyfpdb/fpdb.py Executable file → Normal file
View File

@ -76,7 +76,7 @@ import SQL
import Database
import FpdbSQLQueries
import Configuration
from Exceptions import *
import Exceptions
VERSION = "0.11"
@ -455,6 +455,9 @@ class fpdb:
self.sql = SQL.Sql(type = self.settings['db-type'], db_server = self.settings['db-server'])
try:
self.db = Database.Database(self.config, sql = self.sql)
except Exceptions.FpdbMySQLFailedError:
self.warning_box("Unable to connect to MySQL! Is the MySQL server running?!", "FPDB ERROR")
exit()
except FpdbError:
print "Failed to connect to %s database with username %s." % (self.settings['db-server'], self.settings['db-user'])
sys.stderr.write("Failed to connect to %s database with username %s." % (self.settings['db-server'], self.settings['db-user']))

View File

@ -80,7 +80,7 @@ class fpdb_db:
try:
self.db = MySQLdb.connect(host = host, user = user, passwd = password, db = database, use_unicode=True)
except:
raise FpdbError("MySQL connection failed")
raise FpdbMySQLFailedError("MySQL connection failed")
elif backend==fpdb_db.PGSQL:
import psycopg2
import psycopg2.extensions