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) self.hands['playersVpi'] = len(vpipers)
def playersAtStreetX(self, hand): 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 # self.actions[street] is a list of all actions in a tuple, contining the player name first
# [ (player, action, ....), (player2, action, ...) ] # [ (player, action, ....), (player2, action, ...) ]
# The number of unique players in the list per street gives the value for playersAtStreetXXX # 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, ...) ] # [ (player, action, ....), (player2, action, ...) ]
# No idea what this value is actually supposed to be # 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 # 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): def aggr(self, hand, i):
aggrers = set() aggrers = set()

View File

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

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

@ -76,7 +76,7 @@ import SQL
import Database import Database
import FpdbSQLQueries import FpdbSQLQueries
import Configuration import Configuration
from Exceptions import * import Exceptions
VERSION = "0.11" VERSION = "0.11"
@ -455,6 +455,9 @@ class fpdb:
self.sql = SQL.Sql(type = self.settings['db-type'], db_server = self.settings['db-server']) self.sql = SQL.Sql(type = self.settings['db-type'], db_server = self.settings['db-server'])
try: try:
self.db = Database.Database(self.config, sql = self.sql) 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: except FpdbError:
print "Failed to connect to %s database with username %s." % (self.settings['db-server'], self.settings['db-user']) 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'])) 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: try:
self.db = MySQLdb.connect(host = host, user = user, passwd = password, db = database, use_unicode=True) self.db = MySQLdb.connect(host = host, user = user, passwd = password, db = database, use_unicode=True)
except: except:
raise FpdbError("MySQL connection failed") raise FpdbMySQLFailedError("MySQL connection failed")
elif backend==fpdb_db.PGSQL: elif backend==fpdb_db.PGSQL:
import psycopg2 import psycopg2
import psycopg2.extensions import psycopg2.extensions