Make a whole bunch of config defaults work as desired.

This commit is contained in:
Ray 2009-03-16 23:34:00 -04:00
parent 067373b128
commit 466f6c09c2

View File

@ -450,19 +450,26 @@ class Config:
def get_db_parameters(self, name = None): def get_db_parameters(self, name = None):
if name == None: name = 'fpdb' if name == None: name = 'fpdb'
db = {} db = {}
try: try: db['db-databaseName'] = name
db['db-databaseName'] = name except: pass
db['db-host'] = self.supported_databases[name].db_ip
db['db-user'] = self.supported_databases[name].db_user try: db['db-host'] = self.supported_databases[name].db_ip
db['db-password'] = self.supported_databases[name].db_pass except: pass
db['db-server'] = self.supported_databases[name].db_server
if string.lower(self.supported_databases[name].db_server) == 'mysql': try: db['db-user'] = self.supported_databases[name].db_user
db['db-backend'] = 2 except: pass
elif string.lower(self.supported_databases[name].db_server) == 'postgresql':
db['db-backend'] = 3 try: db['db-password'] = self.supported_databases[name].db_pass
else: db['db-backend'] = None # this is big trouble except: pass
except:
pass try: db['db-server'] = self.supported_databases[name].db_server
except: pass
if string.lower(self.supported_databases[name].db_server) == 'mysql':
db['db-backend'] = 2
elif string.lower(self.supported_databases[name].db_server) == 'postgresql':
db['db-backend'] = 3
else: db['db-backend'] = None # this is big trouble
return db return db
def set_db_parameters(self, db_name = 'fpdb', db_ip = None, db_user = None, def set_db_parameters(self, db_name = 'fpdb', db_ip = None, db_user = None,
@ -484,30 +491,32 @@ class Config:
def get_tv_parameters(self): def get_tv_parameters(self):
tv = {} tv = {}
try: try: tv['combinedStealFold'] = self.tv.combinedStealFold
tv['combinedStealFold'] = self.tv.combinedStealFold except: tv['combinedStealFold'] = True
tv['combined2B3B'] = self.tv.combined2B3B
tv['combinedPostflop'] = self.tv.combinedPostflop try: tv['combined2B3B'] = self.tv.combined2B3B
except: # Default tv parameters except: tv['combined2B3B'] = True
tv['combinedStealFold'] = True
tv['combined2B3B'] = True try: tv['combinedPostflop'] = self.tv.combinedPostflop
tv['combinedPostflop'] = True except: tv['combinedPostflop'] = True
return tv return tv
def get_import_parameters(self): def get_import_parameters(self):
imp = {} imp = {}
try: try: imp['callFpdbHud'] = self.imp.callFpdbHud
imp['callFpdbHud'] = self.imp.callFpdbHud except: imp['callFpdbHud'] = True
imp['interval'] = self.imp.interval
imp['hhArchiveBase'] = self.imp.hhArchiveBase try: imp['interval'] = self.imp.interval
imp['saveActions'] = self.imp.saveActions except: imp['interval'] = 10
imp['fastStoreHudCache'] = self.imp.fastStoreHudCache
except: # Default params try: imp['hhArchiveBase'] = self.imp.hhArchiveBase
imp['callFpdbHud'] = True except: imp['hhArchiveBase'] = "~/.fpdb/HandHistories/"
imp['interval'] = 10
imp['hhArchiveBase'] = "~/.fpdb/HandHistories/" try: imp['saveActions'] = self.imp.saveActions
imp['saveActions'] = True except: imp['saveActions'] = True
imp['fastStoreHudCache'] = True
try: imp['fastStoreHudCache'] = self.imp.fastStoreHudCache
except: imp['fastStoreHudCache'] = True
return imp return imp
def get_default_paths(self, site = "PokerStars"): def get_default_paths(self, site = "PokerStars"):