fix different shortcuts for stop AI, string unification, remove leading/trailing whitespace

This commit is contained in:
Steffen Schaumburg 2011-04-08 11:12:38 +02:00
parent 00bef8f83f
commit f3b4bb6fd0
4 changed files with 238 additions and 196 deletions

View File

@ -1062,14 +1062,15 @@ class Database:
cons = c.fetchone() cons = c.fetchone()
#print "preparebulk find fk: cons=", cons #print "preparebulk find fk: cons=", cons
if cons: if cons:
print "dropping foreign key ", cons[0], fk['fktab'], fk['fkcol'] print _("Dropping foreign key:"), cons[0], fk['fktab'], fk['fkcol']
try: try:
c.execute("alter table " + fk['fktab'] + " drop foreign key " + cons[0]) c.execute("alter table " + fk['fktab'] + " drop foreign key " + cons[0])
except: except:
print " drop failed: " + str(sys.exc_info()) print _("Warning:"), _("Drop foreign key %s_%s_fkey failed: %s, continuing ...") \
% (fk['fktab'], fk['fkcol'], str(sys.exc_value).rstrip('\n') )
elif self.backend == self.PGSQL: elif self.backend == self.PGSQL:
# DON'T FORGET TO RECREATE THEM!! # DON'T FORGET TO RECREATE THEM!!
print "dropping pg fk", fk['fktab'], fk['fkcol'] print _("Dropping foreign key:"), fk['fktab'], fk['fkcol']
try: try:
# try to lock table to see if index drop will work: # try to lock table to see if index drop will work:
# hmmm, tested by commenting out rollback in grapher. lock seems to work but # hmmm, tested by commenting out rollback in grapher. lock seems to work but
@ -1081,10 +1082,10 @@ class Database:
#print "alter table %s drop constraint %s_%s_fkey" % (fk['fktab'], fk['fktab'], fk['fkcol']) #print "alter table %s drop constraint %s_%s_fkey" % (fk['fktab'], fk['fktab'], fk['fkcol'])
try: try:
c.execute("alter table %s drop constraint %s_%s_fkey" % (fk['fktab'], fk['fktab'], fk['fkcol'])) c.execute("alter table %s drop constraint %s_%s_fkey" % (fk['fktab'], fk['fktab'], fk['fkcol']))
print "dropped foreign key %s_%s_fkey, continuing ..." % (fk['fktab'], fk['fkcol']) print _("dropped foreign key %s_%s_fkey, continuing ...") % (fk['fktab'], fk['fkcol'])
except: except:
if "does not exist" not in str(sys.exc_value): if "does not exist" not in str(sys.exc_value):
print _("Warning:"), _("drop foreign key %s_%s_fkey failed: %s, continuing ...") \ print _("Warning:"), _("Drop foreign key %s_%s_fkey failed: %s, continuing ...") \
% (fk['fktab'], fk['fkcol'], str(sys.exc_value).rstrip('\n') ) % (fk['fktab'], fk['fkcol'], str(sys.exc_value).rstrip('\n') )
c.execute("END TRANSACTION") c.execute("END TRANSACTION")
except: except:
@ -1096,18 +1097,18 @@ 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 _("Dropping index "), idx['tab'], idx['col'] print _("Dropping index:"), idx['tab'], idx['col']
try: try:
# apparently nowait is not implemented in mysql so this just hangs if there are locks # apparently nowait is not implemented in mysql so this just hangs if there are locks
# preventing the index drop :-( # preventing the index drop :-(
c.execute( "alter table %s drop index %s;", (idx['tab'],idx['col']) ) c.execute( "alter table %s drop index %s;", (idx['tab'],idx['col']) )
except: except:
print _(" drop index failed: ") + str(sys.exc_info()) print _("Drop index failed:"), str(sys.exc_info())
# ALTER TABLE `fpdb`.`handsplayers` DROP INDEX `playerId`; # ALTER TABLE `fpdb`.`handsplayers` DROP INDEX `playerId`;
# using: 'HandsPlayers' drop index 'playerId' # using: 'HandsPlayers' drop index 'playerId'
elif self.backend == self.PGSQL: elif self.backend == self.PGSQL:
# DON'T FORGET TO RECREATE THEM!! # DON'T FORGET TO RECREATE THEM!!
print _("Dropping index "), idx['tab'], idx['col'] print _("Dropping index:"), idx['tab'], idx['col']
try: try:
# try to lock table to see if index drop will work: # try to lock table to see if index drop will work:
c.execute("BEGIN TRANSACTION") c.execute("BEGIN TRANSACTION")
@ -1164,22 +1165,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:
return -1 return -1
@ -1191,7 +1192,7 @@ class Database:
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)
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:
# pass # pass
# mod to use tab_col for index name? # mod to use tab_col for index name?
@ -1200,7 +1201,7 @@ class Database:
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)
except: except:
print _("Create index failed: ") + str(sys.exc_info()) print _("Create index failed:"), str(sys.exc_info())
else: else:
return -1 return -1
@ -1289,7 +1290,7 @@ class Database:
except: except:
#print "Error creating tables: ", str(sys.exc_value) #print "Error creating tables: ", str(sys.exc_value)
err = traceback.extract_tb(sys.exc_info()[2])[-1] err = traceback.extract_tb(sys.exc_info()[2])[-1]
print _("***Error creating tables: ")+err[2]+"("+str(err[1])+"): "+str(sys.exc_info()[1]) print _("***Error creating tables:"), err[2]+"("+str(err[1])+"): "+str(sys.exc_info()[1])
self.rollback() self.rollback()
raise raise
#end def disconnect #end def disconnect
@ -1311,7 +1312,7 @@ class Database:
c.execute(self.sql.query['drop_table'] + table[0]) c.execute(self.sql.query['drop_table'] + table[0])
except: except:
err = traceback.extract_tb(sys.exc_info()[2])[-1] err = traceback.extract_tb(sys.exc_info()[2])[-1]
print _("***Error dropping tables: ")+err[2]+"("+str(err[1])+"): "+str(sys.exc_info()[1]) print _("***Error dropping tables:"), +err[2]+"("+str(err[1])+"): "+str(sys.exc_info()[1])
self.rollback() self.rollback()
elif backend == 'PostgreSQL': elif backend == 'PostgreSQL':
try: try:
@ -1322,7 +1323,7 @@ class Database:
c.execute(self.sql.query['drop_table'] + table[0] + ' cascade') c.execute(self.sql.query['drop_table'] + table[0] + ' cascade')
except: except:
err = traceback.extract_tb(sys.exc_info()[2])[-1] err = traceback.extract_tb(sys.exc_info()[2])[-1]
print _("***Error dropping tables: ")+err[2]+"("+str(err[1])+"): "+str(sys.exc_info()[1]) print _("***Error dropping tables:"), err[2]+"("+str(err[1])+"): "+str(sys.exc_info()[1])
self.rollback() self.rollback()
elif backend == 'SQLite': elif backend == 'SQLite':
try: try:
@ -1332,14 +1333,14 @@ class Database:
c.execute(self.sql.query['drop_table'] + table[0]) c.execute(self.sql.query['drop_table'] + table[0])
except: except:
err = traceback.extract_tb(sys.exc_info()[2])[-1] err = traceback.extract_tb(sys.exc_info()[2])[-1]
print _("***Error dropping tables: ")+err[2]+"("+str(err[1])+"): "+str(sys.exc_info()[1]) print _("***Error dropping tables:"), err[2]+"("+str(err[1])+"): "+str(sys.exc_info()[1])
self.rollback() self.rollback()
try: try:
self.commit() self.commit()
except: except:
print _("*** Error in committing table drop") print _("*** Error in committing table drop")
err = traceback.extract_tb(sys.exc_info()[2])[-1] err = traceback.extract_tb(sys.exc_info()[2])[-1]
print _("***Error dropping tables: ")+err[2]+"("+str(err[1])+"): "+str(sys.exc_info()[1]) print _("***Error dropping tables:"), err[2]+"("+str(err[1])+"): "+str(sys.exc_info()[1])
self.rollback() self.rollback()
#end def drop_tables #end def drop_tables
@ -1357,7 +1358,7 @@ class Database:
s = "create index %s on %s(%s)" % (idx['col'],idx['tab'],idx['col']) s = "create index %s on %s(%s)" % (idx['col'],idx['tab'],idx['col'])
self.get_cursor().execute(s) self.get_cursor().execute(s)
except: except:
print _("Create index failed: ") + str(sys.exc_info()) print _("Create index failed:"), str(sys.exc_info())
elif self.backend == self.PGSQL: elif self.backend == self.PGSQL:
# mod to use tab_col for index name? # mod to use tab_col for index name?
print _("Creating index %s %s") %(idx['tab'], idx['col']) print _("Creating index %s %s") %(idx['tab'], idx['col'])
@ -1366,7 +1367,7 @@ class Database:
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'])
self.get_cursor().execute(s) self.get_cursor().execute(s)
except: except:
print _("Create index failed: ") + str(sys.exc_info()) print _("Create index failed:"), str(sys.exc_info())
elif self.backend == self.SQLITE: elif self.backend == self.SQLITE:
print _("Creating index %s %s") %(idx['tab'], idx['col']) print _("Creating index %s %s") %(idx['tab'], idx['col'])
log.debug(_("Creating index %s %s") %(idx['tab'], idx['col'])) log.debug(_("Creating index %s %s") %(idx['tab'], idx['col']))
@ -1374,14 +1375,14 @@ class Database:
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'])
self.get_cursor().execute(s) self.get_cursor().execute(s)
except: except:
log.debug(_("Create index failed: ") + str(sys.exc_info())) log.debug(_("Create index failed:"), str(sys.exc_info()))
else: else:
return -1 return -1
if self.backend == self.PGSQL: if self.backend == self.PGSQL:
self.connection.set_isolation_level(1) # go back to normal isolation level self.connection.set_isolation_level(1) # go back to normal isolation level
except: except:
print _("Error creating indexes: ") + str(sys.exc_value) print _("Error creating indexes:"), str(sys.exc_value)
raise FpdbError("Error creating indexes: " + str(sys.exc_value) ) raise FpdbError("Error creating indexes:" + " " + str(sys.exc_value) )
#end def createAllIndexes #end def createAllIndexes
def dropAllIndexes(self): def dropAllIndexes(self):
@ -1392,27 +1393,27 @@ class Database:
self.connection.set_isolation_level(0) # allow table/index operations to work self.connection.set_isolation_level(0) # allow table/index operations to work
for idx in self.indexes[self.backend]: for idx in self.indexes[self.backend]:
if self.backend == self.MYSQL_INNODB: if self.backend == self.MYSQL_INNODB:
print _("dropping index "), idx['tab'], idx['col'] print (_("Dropping index:"), idx['tab'], idx['col'])
try: try:
self.get_cursor().execute( "alter table %s drop index %s" self.get_cursor().execute( "alter table %s drop index %s"
, (idx['tab'], idx['col']) ) , (idx['tab'], idx['col']) )
except: except:
print _(" drop index failed: ") + str(sys.exc_info()) print _("Drop index failed:"), str(sys.exc_info())
elif self.backend == self.PGSQL: elif self.backend == self.PGSQL:
print _("dropping index "), idx['tab'], idx['col'] print (_("Dropping index:"), idx['tab'], idx['col'])
# mod to use tab_col for index name? # mod to use tab_col for index name?
try: try:
self.get_cursor().execute( "drop index %s_%s_idx" self.get_cursor().execute( "drop index %s_%s_idx"
% (idx['tab'],idx['col']) ) % (idx['tab'],idx['col']) )
except: except:
print _(" drop index failed: ") + str(sys.exc_info()) print (_("Drop index failed:"), str(sys.exc_info()))
elif self.backend == self.SQLITE: elif self.backend == self.SQLITE:
print _("Dropping index "), idx['tab'], idx['col'] print (_("Dropping index:"), idx['tab'], idx['col'])
try: try:
self.get_cursor().execute( "drop index %s_%s_idx" self.get_cursor().execute( "drop index %s_%s_idx"
% (idx['tab'],idx['col']) ) % (idx['tab'],idx['col']) )
except: except:
print _(" drop index failed: ") + str(sys.exc_info()) print _("Drop index failed:"), str(sys.exc_info())
else: else:
return -1 return -1
if self.backend == self.PGSQL: if self.backend == self.PGSQL:
@ -1427,7 +1428,7 @@ class Database:
self.connection.set_isolation_level(0) # allow table/index operations to work self.connection.set_isolation_level(0) # allow table/index operations to work
c = self.get_cursor() c = self.get_cursor()
except: except:
print _(" set_isolation_level failed: ") + str(sys.exc_info()) print _("set_isolation_level failed:"), str(sys.exc_info())
for fk in self.foreignKeys[self.backend]: for fk in self.foreignKeys[self.backend]:
if self.backend == self.MYSQL_INNODB: if self.backend == self.MYSQL_INNODB:
@ -1444,22 +1445,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:
pass pass
@ -1467,7 +1468,7 @@ class Database:
if self.backend == self.PGSQL: if self.backend == self.PGSQL:
self.connection.set_isolation_level(1) # go back to normal isolation level self.connection.set_isolation_level(1) # go back to normal isolation level
except: except:
print _(" set_isolation_level failed: ") + str(sys.exc_info()) print _("set_isolation_level failed:"), str(sys.exc_info())
#end def createAllForeignKeys #end def createAllForeignKeys
def dropAllForeignKeys(self): def dropAllForeignKeys(self):
@ -1491,14 +1492,15 @@ class Database:
cons = c.fetchone() cons = c.fetchone()
#print "preparebulk find fk: cons=", cons #print "preparebulk find fk: cons=", cons
if cons: if cons:
print _("dropping foreign key"), cons[0], fk['fktab'], fk['fkcol'] print _("Dropping foreign key:"), cons[0], fk['fktab'], fk['fkcol']
try: try:
c.execute("alter table " + fk['fktab'] + " drop foreign key " + cons[0]) c.execute("alter table " + fk['fktab'] + " drop foreign key " + cons[0])
except: except:
print _(" drop failed: ") + str(sys.exc_info()) print _("Warning:"), _("Drop foreign key %s_%s_fkey failed: %s, continuing ...") \
% (fk['fktab'], fk['fkcol'], str(sys.exc_value).rstrip('\n') )
elif self.backend == self.PGSQL: elif self.backend == self.PGSQL:
# DON'T FORGET TO RECREATE THEM!! # DON'T FORGET TO RECREATE THEM!!
print _("dropping foreign key"), fk['fktab'], fk['fkcol'] print _("Dropping foreign key:"), fk['fktab'], fk['fkcol']
try: try:
# try to lock table to see if index drop will work: # try to lock table to see if index drop will work:
# hmmm, tested by commenting out rollback in grapher. lock seems to work but # hmmm, tested by commenting out rollback in grapher. lock seems to work but
@ -1513,7 +1515,7 @@ class Database:
print _("dropped foreign key %s_%s_fkey, continuing ...") % (fk['fktab'], fk['fkcol']) print _("dropped foreign key %s_%s_fkey, continuing ...") % (fk['fktab'], fk['fkcol'])
except: except:
if "does not exist" not in str(sys.exc_value): if "does not exist" not in str(sys.exc_value):
print _("Warning:"), _("drop foreign key %s_%s_fkey failed: %s, continuing ...") \ print _("Warning:"), _("Drop foreign key %s_%s_fkey failed: %s, continuing ...") \
% (fk['fktab'], fk['fkcol'], str(sys.exc_value).rstrip('\n') ) % (fk['fktab'], fk['fkcol'], str(sys.exc_value).rstrip('\n') )
c.execute("END TRANSACTION") c.execute("END TRANSACTION")
except: except:
@ -2604,7 +2606,7 @@ class Database:
print _("queue empty too long - writer stopping ...") print _("queue empty too long - writer stopping ...")
break break
except: except:
print _("writer stopping, error reading queue: ") + str(sys.exc_info()) print _("writer stopping, error reading queue:"), str(sys.exc_info())
break break
#print "got hand", str(h.get_finished()) #print "got hand", str(h.get_finished())
@ -2634,11 +2636,11 @@ class Database:
wait = wait + wait wait = wait + wait
again = True again = True
else: else:
print _("too many deadlocks - failed to store hand ") + h.get_siteHandNo() print _("Too many deadlocks - failed to store hand"), h.get_siteHandNo()
if not again: if not again:
fails = fails + 1 fails = fails + 1
err = traceback.extract_tb(sys.exc_info()[2])[-1] err = traceback.extract_tb(sys.exc_info()[2])[-1]
print _("***Error storing hand: ")+err[2]+"("+str(err[1])+"): "+str(sys.exc_info()[1]) print _("***Error storing hand:"), err[2]+"("+str(err[1])+"): "+str(sys.exc_info()[1])
# finished trying to store hand # finished trying to store hand
# always reduce q count, whether or not this hand was saved ok # always reduce q count, whether or not this hand was saved ok
@ -2658,7 +2660,7 @@ class Database:
q.put(h) q.put(h)
except: except:
err = traceback.extract_tb(sys.exc_info()[2])[-1] err = traceback.extract_tb(sys.exc_info()[2])[-1]
print _("***Error sending finish: ")+err[2]+"("+str(err[1])+"): "+str(sys.exc_info()[1]) print _("***Error sending finish:"), err[2]+"("+str(err[1])+"): "+str(sys.exc_info()[1])
# end def send_finish_msg(): # end def send_finish_msg():
def createTourneyType(self, hand):#note: this method is used on Hand and TourneySummary objects def createTourneyType(self, hand):#note: this method is used on Hand and TourneySummary objects
@ -2744,7 +2746,7 @@ class Database:
(hand.tourneyTypeId, hand.tourNo, hand.entries, hand.prizepool, hand.startTime, (hand.tourneyTypeId, hand.tourNo, hand.entries, hand.prizepool, hand.startTime,
hand.endTime, hand.tourneyName, hand.matrixIdProcessed, hand.totalRebuyCount, hand.totalAddOnCount)) hand.endTime, hand.tourneyName, hand.matrixIdProcessed, hand.totalRebuyCount, hand.totalAddOnCount))
else: else:
raise FpdbParseError(_("invalid source in Database.createOrUpdateTourney")) raise FpdbParseError(_("invalid source in %s") % Database.createOrUpdateTourney)
tourneyId = self.get_last_insert_id(cursor) tourneyId = self.get_last_insert_id(cursor)
return tourneyId return tourneyId
#end def createOrUpdateTourney #end def createOrUpdateTourney
@ -2757,7 +2759,7 @@ class Database:
elif source=="HHC": elif source=="HHC":
playerId = hand.dbid_pids[player[1]] playerId = hand.dbid_pids[player[1]]
else: else:
raise FpdbParseError(_("invalid source in Database.createOrUpdateTourneysPlayers")) raise FpdbParseError(_("invalid source in %s") % Database.createOrUpdateTourneysPlayers)
cursor = self.get_cursor() cursor = self.get_cursor()
cursor.execute (self.sql.query['getTourneysPlayersByIds'].replace('%s', self.sql.query['placeholder']), cursor.execute (self.sql.query['getTourneysPlayersByIds'].replace('%s', self.sql.query['placeholder']),
@ -2893,7 +2895,7 @@ class HandToWrite:
self.tableName = None self.tableName = None
self.seatNos = None self.seatNos = None
except: except:
print _("HandToWrite.init error: ") + str(sys.exc_info()) print _("%s error: %s") % ("HandToWrite.init", str(sys.exc_info()))
raise raise
# end def __init__ # end def __init__
@ -2943,7 +2945,7 @@ class HandToWrite:
self.tableName = tableName self.tableName = tableName
self.seatNos = seatNos self.seatNos = seatNos
except: except:
print _("HandToWrite.set_all error: ") + str(sys.exc_info()) print _("%s error: %s") % ("HandToWrite.set_all", str(sys.exc_info()))
raise raise
# end def set_hand # end def set_hand
@ -2982,7 +2984,7 @@ if __name__=="__main__":
c = db_connection.get_cursor() c = db_connection.get_cursor()
c.execute('explain query plan '+sql.query['get_table_name'], (h, )) c.execute('explain query plan '+sql.query['get_table_name'], (h, ))
for row in c.fetchall(): for row in c.fetchall():
print _("query plan: "), row print "Query plan:", row
print print
t0 = time() t0 = time()
@ -2996,7 +2998,7 @@ if __name__=="__main__":
print _("get_stats took: %4.3f seconds") % (t1-t0) print _("get_stats took: %4.3f seconds") % (t1-t0)
print _("press enter to continue") print _("Press ENTER to continue.")
sys.stdin.readline() sys.stdin.readline()
#Code borrowed from http://push.cx/2008/caching-dictionaries-in-python-vs-ruby #Code borrowed from http://push.cx/2008/caching-dictionaries-in-python-vs-ruby

View File

@ -242,7 +242,7 @@ class GuiAutoImport (threading.Thread):
if self.settings['global_lock'].acquire(wait=False, source="AutoImport"): # returns false immediately if lock not acquired if self.settings['global_lock'].acquire(wait=False, source="AutoImport"): # returns false immediately if lock not acquired
self.addText(_("\nGlobal lock taken ... Auto Import Started.\n")) self.addText(_("\nGlobal lock taken ... Auto Import Started.\n"))
self.doAutoImportBool = True self.doAutoImportBool = True
self.startButton.set_label(_(u' _Stop Auto Import ')) self.startButton.set_label(_(u'Stop _Auto Import'))
while gtk.events_pending(): # change the label NOW don't wait for the pipe to open while gtk.events_pending(): # change the label NOW don't wait for the pipe to open
gtk.main_iteration(False) gtk.main_iteration(False)
if self.pipe_to_hud is None: if self.pipe_to_hud is None:
@ -276,7 +276,7 @@ class GuiAutoImport (threading.Thread):
except: except:
err = traceback.extract_tb(sys.exc_info()[2])[-1] err = traceback.extract_tb(sys.exc_info()[2])[-1]
#self.addText( "\n*** GuiAutoImport Error opening pipe: " + err[2] + "(" + str(err[1]) + "): " + str(sys.exc_info()[1])) #self.addText( "\n*** GuiAutoImport Error opening pipe: " + err[2] + "(" + str(err[1]) + "): " + str(sys.exc_info()[1]))
self.addText(_("\n*** GuiAutoImport Error opening pipe: ") + traceback.format_exc() ) self.addText("\n" + _("*** GuiAutoImport Error opening pipe:") + " " + traceback.format_exc() )
else: else:
for site in self.input_settings: for site in self.input_settings:
self.importer.addImportDirectory(self.input_settings[site][0], True, site, self.input_settings[site][1]) self.importer.addImportDirectory(self.input_settings[site][0], True, site, self.input_settings[site][1])

View File

@ -4,8 +4,8 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Free Poker Database\n" "Project-Id-Version: Free Poker Database\n"
"POT-Creation-Date: 2011-04-07 10:56+CEST\n" "POT-Creation-Date: 2011-04-08 10:50+CEST\n"
"PO-Revision-Date: 2011-04-07 05:59+0200\n" "PO-Revision-Date: 2011-04-08 10:49+0200\n"
"Last-Translator: Steffen Schaumburg <steffen@schaumburger.info>\n" "Last-Translator: Steffen Schaumburg <steffen@schaumburger.info>\n"
"Language-Team: Fpdb\n" "Language-Team: Fpdb\n"
"Language: de\n" "Language: de\n"
@ -143,11 +143,11 @@ msgstr "DEBUG: "
msgid "fpdb card encoding(same as pokersource)" msgid "fpdb card encoding(same as pokersource)"
msgstr "fpdb Karten-Kodierung(gleiche wie pokersource)" msgstr "fpdb Karten-Kodierung(gleiche wie pokersource)"
#: Charset.py:45 Charset.py:60 Charset.py:75 Charset.py:86 Charset.py:94 #: Charset.py:43 Charset.py:58 Charset.py:73
msgid "Could not convert: \"%s\"\n" msgid "Could not convert: \"%s\"\n"
msgstr "Konnte \"%s\" nicht konvertieren.\n" msgstr "Konnte \"%s\" nicht konvertieren.\n"
#: Charset.py:48 Charset.py:63 Charset.py:78 #: Charset.py:46 Charset.py:61 Charset.py:76
msgid "Could not encode: \"%s\"\n" msgid "Could not encode: \"%s\"\n"
msgstr "Konnte \"%s% nicht kodieren.\n" msgstr "Konnte \"%s% nicht kodieren.\n"
@ -183,44 +183,46 @@ msgstr "Default Logger für %s initialisiert"
msgid "Creating directory: '%s'" msgid "Creating directory: '%s'"
msgstr "Erstelle Verzeichnis \"%s\"" msgstr "Erstelle Verzeichnis \"%s\""
#: Configuration.py:213 #: Configuration.py:215
msgid "" msgid "Default encoding set to US-ASCII, defaulting to CP1252 instead."
"Default encoding set to US-ASCII, defaulting to CP1252 instead -- If you're "
"not on a Mac, please report this problem."
msgstr "" msgstr ""
"Standardkodierung war auf US-ASCII gesetzt, verwende stattdessen CP1252 - " "Standardkodierung war auf US-ASCII gesetzt, es wird stattdessen CP1252 "
"bitte melde dieses Problem, es sei denn Du spielst an einem Mac." "verwendet."
#: Configuration.py:537 #: Configuration.py:215
msgid "Please report this problem."
msgstr "Bitte melde dieses Problem."
#: Configuration.py:536
msgid "config.general: adding %s = %s" msgid "config.general: adding %s = %s"
msgstr "config.general: Füge %s=%s hinzu" msgstr "config.general: Füge %s=%s hinzu"
#: Configuration.py:584 Configuration.py:585 #: Configuration.py:583 Configuration.py:584
msgid "bad number in xalignment was ignored" msgid "bad number in xalignment was ignored"
msgstr "Unerlaubter Wert in xalignment wurde ignoriert" msgstr "Unerlaubter Wert in xalignment wurde ignoriert"
#: Configuration.py:640 Configuration.py:647 Configuration.py:666 #: Configuration.py:639 Configuration.py:646 Configuration.py:665
#: Configuration.py:673 #: Configuration.py:672
msgid "Invalid config value for %s, defaulting to %s" msgid "Invalid config value for %s, defaulting to %s"
msgstr "Unerlaubter Konfigurationswert für %s, verwende Default %s" msgstr "Unerlaubter Konfigurationswert für %s, verwende Default %s"
#: Configuration.py:691 Configuration.py:692 #: Configuration.py:690 Configuration.py:691
msgid "Configuration file %s not found. Using defaults." msgid "Configuration file %s not found. Using defaults."
msgstr "Konfigurationsdatei %s nicht gefunden. Verwende Defaults." msgstr "Konfigurationsdatei %s nicht gefunden. Verwende Defaults."
#: Configuration.py:722 #: Configuration.py:721
msgid "Reading configuration file %s" msgid "Reading configuration file %s"
msgstr "Lese Konfigurationsdatei %s" msgstr "Lese Konfigurationsdatei %s"
#: Configuration.py:729 #: Configuration.py:728
msgid "Error parsing %s." msgid "Error parsing %s."
msgstr "Fehler beim Parsen von %s." msgstr "Fehler beim Parsen von %s."
#: Configuration.py:729 Configuration.py:845 #: Configuration.py:728 Configuration.py:844
msgid "See error log file." msgid "See error log file."
msgstr "Siehe error Logdatei." msgstr "Siehe error Logdatei."
#: Configuration.py:845 #: Configuration.py:844
msgid "Error parsing example configuration file %s." msgid "Error parsing example configuration file %s."
msgstr "Fehler beim Lesen der Beispielskonfigurationsdatei %s." msgstr "Fehler beim Lesen der Beispielskonfigurationsdatei %s."
@ -278,7 +280,7 @@ msgstr "*** Datenbankfehler: "
#: Database.py:760 #: Database.py:760
msgid "Database: n hands ago the date was:" msgid "Database: n hands ago the date was:"
msgstr "Datenbank: Datum vor n Tagen war:" msgstr "Datenbank: Datum vor n Händen war:"
#: Database.py:917 #: Database.py:917
msgid "ERROR: query %s result does not have player_id as first column" msgid "ERROR: query %s result does not have player_id as first column"
@ -300,25 +302,30 @@ msgstr "getLastInsertId(): Unbekanntes Backend: %d"
msgid "*** Database get_last_insert_id error: " msgid "*** Database get_last_insert_id error: "
msgstr "*** Datenbank get_last_insert_id Fehler: " msgstr "*** Datenbank get_last_insert_id Fehler: "
#: Database.py:1084 Database.py:1514
msgid "dropped foreign key %s_%s_fkey, continuing ..."
msgstr "Foreign Key %s_%s_idx gelöscht, fahre fort ..."
#: Database.py:1087 Database.py:1091 Database.py:1123 Database.py:1127 #: Database.py:1087 Database.py:1091 Database.py:1123 Database.py:1127
#: Database.py:1516 Database.py:1520 fpdb.pyw:1388 #: Database.py:1498 Database.py:1517 Database.py:1521 fpdb.pyw:1387
msgid "Warning:" msgid "Warning:"
msgstr "Warnung:" msgstr "Warnung:"
#: Database.py:1087 Database.py:1516 #: Database.py:1087 Database.py:1498 Database.py:1517
msgid "drop foreign key %s_%s_fkey failed: %s, continuing ..." msgid "Drop foreign key %s_%s_fkey failed: %s, continuing ..."
msgstr "Löschung des Index %s_%s_idx fehlgeschlagen: %s, fahre fort ..." msgstr "Löschung des foreign key %s_%s_fkey fehlgeschlagen: %s, fahre fort ..."
#: Database.py:1091 Database.py:1520 #: Database.py:1091 Database.py:1521
msgid "constraint %s_%s_fkey not dropped: %s, continuing ..." msgid "constraint %s_%s_fkey not dropped: %s, continuing ..."
msgstr "Constraint %s_%s_idx nicht gelöscht: %s, fahre fort ..." msgstr "Constraint %s_%s_fkey nicht gelöscht: %s, fahre fort ..."
#: Database.py:1099 Database.py:1110 Database.py:1410 #: Database.py:1099 Database.py:1110 Database.py:1395 Database.py:1402
msgid "Dropping index " #: Database.py:1410
msgstr "Index wird gelöscht" msgid "Dropping index:"
msgstr "Index wird gelöscht:"
#: Database.py:1105 Database.py:1400 Database.py:1408 Database.py:1415 #: Database.py:1105 Database.py:1400 Database.py:1409 Database.py:1415
msgid " drop index failed: " msgid "Drop index failed:"
msgstr "Index-Löschung fehlgeschlagen:" msgstr "Index-Löschung fehlgeschlagen:"
#: Database.py:1123 #: Database.py:1123
@ -334,8 +341,8 @@ msgid "prepare import took %s seconds"
msgstr "Vorbereitung des Import dauerte %s Sekunden" msgstr "Vorbereitung des Import dauerte %s Sekunden"
#: Database.py:1167 Database.py:1175 Database.py:1447 Database.py:1455 #: Database.py:1167 Database.py:1175 Database.py:1447 Database.py:1455
msgid "Creating foreign key " msgid "Creating foreign key:"
msgstr "Erstelle Foreign Key " msgstr "Erstelle Foreign Key:"
#: Database.py:1173 Database.py:1182 Database.py:1194 Database.py:1453 #: Database.py:1173 Database.py:1182 Database.py:1194 Database.py:1453
#: Database.py:1462 #: Database.py:1462
@ -377,139 +384,122 @@ msgstr "*** Fehler beim Ausführen der Tabellen-Löschung"
#: Database.py:1383 #: Database.py:1383
msgid "Error creating indexes:" msgid "Error creating indexes:"
msgstr "" msgstr "Fehler bei Erstellung der Indexe:"
#: Database.py:1395 Database.py:1402
#, fuzzy
msgid "dropping index "
msgstr "Index wird gelöscht"
#: Database.py:1430 Database.py:1470 #: Database.py:1430 Database.py:1470
msgid "set_isolation_level failed:" msgid "set_isolation_level failed:"
msgstr "" msgstr "set_isolation_level fehlgeschlagen:"
#: Database.py:1494 Database.py:1501 #: Database.py:1494 Database.py:1502
#, fuzzy msgid "Dropping foreign key:"
msgid "dropping foreign key" msgstr "Erstelle Foreign Key:"
msgstr "Erstelle Foreign Key "
#: Database.py:1498 #: Database.py:1637
msgid " drop failed: "
msgstr ""
#: Database.py:1513
#, fuzzy
msgid "dropped foreign key %s_%s_fkey, continuing ..."
msgstr ""
"Warnung: Löschung des Index %s_%s_idx fehlgeschlagen: %s, fahre fort ..."
#: Database.py:1636
msgid "Rebuild hudcache took %.1f seconds" msgid "Rebuild hudcache took %.1f seconds"
msgstr "" msgstr "Neuerstellung des HUD-Cache dauerte %.1f Sekunden"
#: Database.py:1639 Database.py:1753 #: Database.py:1640 Database.py:1754
msgid "Error rebuilding hudcache:" msgid "Error rebuilding hudcache:"
msgstr "" msgstr "Fehler bei Neuerstellung des HUD-Cache"
#: Database.py:1765 Database.py:1771 #: Database.py:1766 Database.py:1772
msgid "Error during analyze:" msgid "Error during analyze:"
msgstr "" msgstr "Fehler während analyze:"
#: Database.py:1775 #: Database.py:1776
msgid "Analyze took %.1f seconds" msgid "Analyze took %.1f seconds"
msgstr "" msgstr "Analyze dauerte %.1f Sekunden"
#: Database.py:1785 Database.py:1791 #: Database.py:1786 Database.py:1792
msgid "Error during vacuum:" msgid "Error during vacuum:"
msgstr "" msgstr "Fehler während vacuum"
#: Database.py:1795 #: Database.py:1796
msgid "Vacuum took %.1f seconds" msgid "Vacuum took %.1f seconds"
msgstr "" msgstr "Vacuum dauerte %.1f Sekunden"
#: Database.py:1835 #: Database.py:1836
msgid "Error during lock_for_insert:" msgid "Error during lock_for_insert:"
msgstr "" msgstr "Fehler in lock_for_insert:"
#: Database.py:1844 #: Database.py:1845
msgid "######## Hands ##########" msgid "######## Hands ##########"
msgstr "" msgstr "######## Hände ##########"
#: Database.py:1848 #: Database.py:1849
msgid "###### End Hands ########" msgid "###### End Hands ########"
msgstr "" msgstr "###### Ende von Hände ########"
#: Database.py:2573 #: Database.py:2574
msgid "######## Gametype ##########" msgid "######## Gametype ##########"
msgstr "" msgstr "######## Gametype ##########"
#: Database.py:2577 #: Database.py:2578
msgid "###### End Gametype ########" msgid "###### End Gametype ########"
msgstr "" msgstr "###### Ende von Gametype ########"
#: Database.py:2604 #: Database.py:2605
msgid "queue empty too long - writer stopping ..." msgid "queue empty too long - writer stopping ..."
msgstr "" msgstr "Queue war zu lange leer - Schreiber wird gestoppt ..."
#: Database.py:2607 #: Database.py:2608
msgid "writer stopping, error reading queue: " msgid "writer stopping, error reading queue: "
msgstr "" msgstr "Schreiber wird angehalten, Fehler beim lesen der Queue: "
#: Database.py:2632 #: Database.py:2633
msgid "deadlock detected - trying again ..." msgid "deadlock detected - trying again ..."
msgstr "" msgstr "Deadlock festgestellt - versuche es nochmal ..."
#: Database.py:2637 #: Database.py:2638
msgid "too many deadlocks - failed to store hand " #, fuzzy
msgstr "" msgid "Too many deadlocks - failed to store hand"
msgstr "Zu viele Deadlocks - konnte Hand nicht speichern"
#: Database.py:2641 #: Database.py:2642
#, fuzzy
msgid "***Error storing hand:" msgid "***Error storing hand:"
msgstr "" msgstr "***Fehler beim Speichern der Hand:"
#: Database.py:2651 #: Database.py:2652
msgid "db writer finished: stored %d hands (%d fails) in %.1f seconds" msgid "db writer finished: stored %d hands (%d fails) in %.1f seconds"
msgstr "" msgstr ""
"DB-Schreiber fertig: %d Hände (%d fehlgeschlagen) in %.1f Sekunden "
"gespeichert"
#: Database.py:2661 #: Database.py:2662
#, fuzzy
msgid "***Error sending finish:" msgid "***Error sending finish:"
msgstr "***Fehler beim Senden von finish: "
#: Database.py:2748 Database.py:2761
msgid "invalid source in %s"
msgstr "" msgstr ""
#: Database.py:2747 #: Database.py:2897 Database.py:2947
msgid "invalid source in Database.createOrUpdateTourney" #, fuzzy
msgstr "" msgid "%s error: %s"
msgstr "Fehler: %s"
#: Database.py:2760 #: Database.py:2978
msgid "invalid source in Database.createOrUpdateTourneysPlayers"
msgstr ""
#: Database.py:2896
msgid "HandToWrite.init error: "
msgstr ""
#: Database.py:2946
msgid "HandToWrite.set_all error: "
msgstr ""
#: Database.py:2977
msgid "nutOmatic is id_player = %d" msgid "nutOmatic is id_player = %d"
msgstr "" msgstr ""
#: Database.py:2985 #: Database.py:2986
msgid "query plan: " msgid "query plan: "
msgstr "" msgstr ""
#: Database.py:2994 #: Database.py:2995
msgid "cards =" msgid "cards ="
msgstr "" msgstr ""
#: Database.py:2997 #: Database.py:2998
msgid "get_stats took: %4.3f seconds" msgid "get_stats took: %4.3f seconds"
msgstr "" msgstr ""
#: Database.py:2999 #: Database.py:3000 HandHistoryConverter.py:41 fpdb.pyw:46 fpdb.pyw:58
msgid "press enter to continue" #: fpdb.pyw:81
msgstr "" msgid "Press ENTER to continue."
msgstr "Drück ENTER um fortzufahren"
#: EverestToFpdb.py:108 FulltiltToFpdb.py:267 FulltiltToFpdb.py:269 #: EverestToFpdb.py:108 FulltiltToFpdb.py:267 FulltiltToFpdb.py:269
msgid "Unable to recognise handinfo from: '%s'" msgid "Unable to recognise handinfo from: '%s'"
@ -1741,7 +1731,7 @@ msgstr ""
msgid "Thankyou" msgid "Thankyou"
msgstr "" msgstr ""
#: GuiSessionViewer.py:164 GuiStove.py:70 fpdb.pyw:1367 #: GuiSessionViewer.py:164 GuiStove.py:70 fpdb.pyw:1366
msgid "FPDB WARNING" msgid "FPDB WARNING"
msgstr "FPDB WARNUNG" msgstr "FPDB WARNUNG"
@ -2387,10 +2377,6 @@ msgid ""
"pypi.python.org/pypi/pytz/" "pypi.python.org/pypi/pytz/"
msgstr "" msgstr ""
#: HandHistoryConverter.py:41 fpdb.pyw:46 fpdb.pyw:58 fpdb.pyw:81
msgid "Press ENTER to continue."
msgstr "Drück ENTER um fortzufahren"
#: HandHistoryConverter.py:130 #: HandHistoryConverter.py:130
msgid "Failed sanity check" msgid "Failed sanity check"
msgstr "" msgstr ""
@ -3949,18 +3935,18 @@ msgid ""
"Any major error will be reported there _only_.\n" "Any major error will be reported there _only_.\n"
msgstr "" msgstr ""
#: fpdb.pyw:1288 #: fpdb.pyw:1287
msgid "fpdb starting ..." msgid "fpdb starting ..."
msgstr "fpdb startet ..." msgstr "fpdb startet ..."
#: fpdb.pyw:1388 #: fpdb.pyw:1387
msgid "" msgid ""
"Unable to find site '%s'\n" "Unable to find site '%s'\n"
"\n" "\n"
"Press YES to add this site to the database." "Press YES to add this site to the database."
msgstr "" msgstr ""
#: fpdb.pyw:1404 #: fpdb.pyw:1403
msgid "" msgid ""
"\n" "\n"
"Enter short code for %s\n" "Enter short code for %s\n"
@ -4087,11 +4073,42 @@ msgid ""
msgstr "" msgstr ""
#, fuzzy #, fuzzy
#~ msgid "Create failed: " #~ msgid "Drop foreign key failed:"
#~ msgstr "Erstellen des Foreign Keys fehlgeschlagen: "
#~ msgid "Creating foreign key "
#~ msgstr "Erstelle Foreign Key "
#~ msgid "Create foreign key failed: "
#~ msgstr "Erstellen des Foreign Keys fehlgeschlagen: "
#~ msgid " set_isolation_level failed: "
#~ msgstr " set_isolation_level fehlgeschlagen: "
#~ msgid "Create index failed: "
#~ msgstr "Erstellen des Indexes fehlgeschlagen: " #~ msgstr "Erstellen des Indexes fehlgeschlagen: "
#~ msgid "Creating mysql index %s %s" #~ msgid "drop foreign key %s_%s_fkey failed: %s, continuing ..."
#~ msgstr "Erstelle MySQL Index %s %s" #~ msgstr ""
#~ "Löschung des foreign key %s_%s_fkey fehlgeschlagen: %s, fahre fort ..."
#~ msgid "dropping index "
#~ msgstr "Index wird gelöscht"
#, fuzzy
#~ msgid " drop table failed:"
#~ msgstr " Tabellen-Löschung fehlgeschlagen: "
#~ msgid "invalid source in Database.createOrUpdateTourney"
#~ msgstr "Ungültige Quelle in Database.createOrUpdateTourney"
#, fuzzy
#~ msgid " drop failed: "
#~ msgstr " Index-Löschung fehlgeschlagen: "
#, fuzzy
#~ msgid "warning: drop pg fk %s_%s_fkey failed: %s, continuing ..."
#~ msgstr "Löschung des Index %s_%s_idx fehlgeschlagen: %s, fahre fort ..."
#~ msgid "dropping mysql index " #~ msgid "dropping mysql index "
#~ msgstr "MySQL-Indexe werden gelöscht" #~ msgstr "MySQL-Indexe werden gelöscht"
@ -4099,13 +4116,36 @@ msgstr ""
#~ msgid "dropping pg index " #~ msgid "dropping pg index "
#~ msgstr "PgSQL-Indexe werden gelöscht" #~ msgstr "PgSQL-Indexe werden gelöscht"
#~ msgid "Creating PostgreSQL index "
#~ msgstr "Erstelle PostgreSQL index"
#~ msgid "Creating mysql index %s %s"
#~ msgstr "Erstelle MySQL Index %s %s"
#, fuzzy
#~ msgid "Creating pgsql index %s %s"
#~ msgstr "Erstelle MySQL Index %s %s"
#, fuzzy
#~ msgid "Creating sqlite index %s %s"
#~ msgstr "Erstelle MySQL Index %s %s"
#, fuzzy
#~ msgid "Dropping sqlite index "
#~ msgstr "MySQL-Indexe werden gelöscht"
#, fuzzy
#~ msgid "warning: drop fk %s_%s_fkey failed: %s, continuing ..."
#~ msgstr "Löschung des Index %s_%s_idx fehlgeschlagen: %s, fahre fort ..."
#, fuzzy
#~ msgid "Create failed: "
#~ msgstr "Erstellen des Indexes fehlgeschlagen: "
#, fuzzy #, fuzzy
#~ msgid "Creating index " #~ msgid "Creating index "
#~ msgstr "Erstelle MySQL Index %s %s" #~ msgstr "Erstelle MySQL Index %s %s"
#~ msgid "Creating PostgreSQL index "
#~ msgstr "Erstelle PostgreSQL index"
#~ msgid "Absolute readStudPlayerCards is only a stub." #~ msgid "Absolute readStudPlayerCards is only a stub."
#~ msgstr "Absolute readStudPlayerCards ist nur ein Platzhalter." #~ msgstr "Absolute readStudPlayerCards ist nur ein Platzhalter."