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

@ -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