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

This commit is contained in:
Eric Blade 2011-03-03 02:11:20 -05:00
commit 1ccbdc5465
2 changed files with 9 additions and 9 deletions

View File

@ -163,8 +163,8 @@ def get_logger(file_name, config = "config", fallback = False, log_dir=None, log
log = logging.basicConfig(filename=file, level=logging.INFO) log = logging.basicConfig(filename=file, level=logging.INFO)
log = logging.getLogger() log = logging.getLogger()
# but it looks like default is no output :-( maybe because all the calls name a module? # but it looks like default is no output :-( maybe because all the calls name a module?
log.debug(_("Default logger initialised for ")+file) log.debug(_("Default logger initialised for %s") % file)
print _("Default logger intialised for ")+file print(_("Default logger initialised for %s") % file)
return log return log
def check_dir(path, create = True): def check_dir(path, create = True):
@ -834,7 +834,7 @@ class Config:
try: try:
example_doc = xml.dom.minidom.parse(example_file) example_doc = xml.dom.minidom.parse(example_file)
except: except:
log.error(_("Error parsing example file %s. See error log file.") % (example_file)) log.error(_("Error parsing example configuration file %s. See error log file.") % (example_file))
return nodes_added return nodes_added
for cnode in doc.getElementsByTagName("FreePokerToolsConfig"): for cnode in doc.getElementsByTagName("FreePokerToolsConfig"):

View File

@ -1169,7 +1169,7 @@ class Database:
for idx in self.indexes[self.backend]: for idx in self.indexes[self.backend]:
if idx['drop'] == 1: if idx['drop'] == 1:
if self.backend == self.MYSQL_INNODB: if self.backend == self.MYSQL_INNODB:
print _("Creating mysql index %s %s") % (idx['tab'], idx['col']) print _("Creating MySQL index %s %s") % (idx['tab'], idx['col'])
try: try:
s = "alter table %s add index %s(%s)" % (idx['tab'],idx['col'],idx['col']) s = "alter table %s add index %s(%s)" % (idx['tab'],idx['col'],idx['col'])
c.execute(s) c.execute(s)
@ -1178,7 +1178,7 @@ class Database:
elif self.backend == self.PGSQL: elif self.backend == self.PGSQL:
# pass # pass
# mod to use tab_col for index name? # mod to use tab_col for index name?
print _("Creating pg index "), idx['tab'], idx['col'] print _("Creating PostgreSQL index "), idx['tab'], idx['col']
try: try:
s = "create index %s_%s_idx on %s(%s)" % (idx['tab'], idx['col'], idx['tab'], idx['col']) s = "create index %s_%s_idx on %s(%s)" % (idx['tab'], idx['col'], idx['tab'], idx['col'])
c.execute(s) c.execute(s)
@ -1423,22 +1423,22 @@ class Database:
if cons: if cons:
pass pass
else: else:
print _("creating foreign key "), fk['fktab'], fk['fkcol'], "->", fk['rtab'], fk['rcol'] print _("Creating foreign key "), fk['fktab'], fk['fkcol'], "->", fk['rtab'], fk['rcol']
try: try:
c.execute("alter table " + fk['fktab'] + " add foreign key (" c.execute("alter table " + fk['fktab'] + " add foreign key ("
+ fk['fkcol'] + ") references " + fk['rtab'] + "(" + fk['fkcol'] + ") references " + fk['rtab'] + "("
+ fk['rcol'] + ")") + fk['rcol'] + ")")
except: except:
print _(" create foreign key failed: ") + str(sys.exc_info()) print _("Create foreign key failed: ") + str(sys.exc_info())
elif self.backend == self.PGSQL: elif self.backend == self.PGSQL:
print _("creating foreign key "), fk['fktab'], fk['fkcol'], "->", fk['rtab'], fk['rcol'] print _("Creating foreign key "), fk['fktab'], fk['fkcol'], "->", fk['rtab'], fk['rcol']
try: try:
c.execute("alter table " + fk['fktab'] + " add constraint " c.execute("alter table " + fk['fktab'] + " add constraint "
+ fk['fktab'] + '_' + fk['fkcol'] + '_fkey' + fk['fktab'] + '_' + fk['fkcol'] + '_fkey'
+ " foreign key (" + fk['fkcol'] + " foreign key (" + fk['fkcol']
+ ") references " + fk['rtab'] + "(" + fk['rcol'] + ")") + ") references " + fk['rtab'] + "(" + fk['rcol'] + ")")
except: except:
print _(" create foreign key failed: ") + str(sys.exc_info()) print _("Create foreign key failed: ") + str(sys.exc_info())
else: else:
print _("Only MySQL and Postgres supported so far") print _("Only MySQL and Postgres supported so far")