From d4e54e6aaee424055a4c0e39c87b57711147e0ca Mon Sep 17 00:00:00 2001 From: steffen123 Date: Tue, 13 Jul 2010 18:04:26 +0200 Subject: [PATCH] POLISH: it can now quit when it wasn't able to connect to DB --- pyfpdb/fpdb.pyw | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/pyfpdb/fpdb.pyw b/pyfpdb/fpdb.pyw index 4ba3bb4a..1afec904 100755 --- a/pyfpdb/fpdb.pyw +++ b/pyfpdb/fpdb.pyw @@ -845,15 +845,18 @@ class fpdb: print "Quitting normally" # TODO: check if current settings differ from profile, if so offer to save or abort - if self.db.backend==self.db.MYSQL_INNODB: - try: + if self.db!=None: + if self.db.backend==self.db.MYSQL_INNODB: + try: + if self.db is not None and self.db.connected: + self.db.disconnect() + except _mysql_exceptions.OperationalError: # oh, damn, we're already disconnected + pass + else: if self.db is not None and self.db.connected: self.db.disconnect() - except _mysql_exceptions.OperationalError: # oh, damn, we're already disconnected - pass else: - if self.db is not None and self.db.connected: - self.db.disconnect() + pass self.statusIcon.set_visible(False) self.window.destroy() # explicitly destroy to allow child windows to close cleanly