From aa0610dcfacd278724f496786822baa09175eaba Mon Sep 17 00:00:00 2001 From: Eric Blade Date: Sun, 16 Aug 2009 04:46:41 -0500 Subject: [PATCH] fpdb: remove error trap on "Recreate Tables" menu option - trapping should be much more localized. --- pyfpdb/fpdb.py | 43 ++++++++++++++++++++----------------------- 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/pyfpdb/fpdb.py b/pyfpdb/fpdb.py index 23bb4495..08c1eca2 100755 --- a/pyfpdb/fpdb.py +++ b/pyfpdb/fpdb.py @@ -243,30 +243,27 @@ class fpdb: if self.obtain_global_lock(): # returns true if successful #lock_released = False - try: - dia_confirm = gtk.MessageDialog(parent=None, flags=0, type=gtk.MESSAGE_WARNING, - buttons=(gtk.BUTTONS_YES_NO), message_format="Confirm deleting and recreating tables") - diastring = "Please confirm that you want to (re-)create the tables. If there already are tables in the database " \ - +self.db.fdb.database+" on "+self.db.fdb.host+" they will be deleted." - dia_confirm.format_secondary_text(diastring)#todo: make above string with bold for db, host and deleted + dia_confirm = gtk.MessageDialog(parent=None, flags=0, type=gtk.MESSAGE_WARNING, + buttons=(gtk.BUTTONS_YES_NO), message_format="Confirm deleting and recreating tables") + diastring = "Please confirm that you want to (re-)create the tables. If there already are tables in the database " \ + +self.db.fdb.database+" on "+self.db.fdb.host+" they will be deleted." + dia_confirm.format_secondary_text(diastring)#todo: make above string with bold for db, host and deleted - response = dia_confirm.run() - dia_confirm.destroy() - if response == gtk.RESPONSE_YES: - #if self.db.fdb.backend == self.fdb_lock.fdb.MYSQL_INNODB: - # mysql requires locks on all tables or none - easier to release this lock - # than lock all the other tables - # ToDo: lock all other tables so that lock doesn't have to be released - # self.release_global_lock() - # lock_released = True - self.db.recreate_tables() - #else: - # for other dbs use same connection as holds global lock - # self.fdb_lock.fdb.recreate_tables() - elif response == gtk.RESPONSE_NO: - print 'User cancelled recreating tables' - except: - pass + response = dia_confirm.run() + dia_confirm.destroy() + if response == gtk.RESPONSE_YES: + #if self.db.fdb.backend == self.fdb_lock.fdb.MYSQL_INNODB: + # mysql requires locks on all tables or none - easier to release this lock + # than lock all the other tables + # ToDo: lock all other tables so that lock doesn't have to be released + # self.release_global_lock() + # lock_released = True + self.db.recreate_tables() + #else: + # for other dbs use same connection as holds global lock + # self.fdb_lock.fdb.recreate_tables() + elif response == gtk.RESPONSE_NO: + print 'User cancelled recreating tables' #if not lock_released: self.release_global_lock() #end def dia_recreate_tables