POLISH: it can now quit when it wasn't able to connect to DB

This commit is contained in:
steffen123 2010-07-13 18:04:26 +02:00
parent 1d571cabee
commit d4e54e6aae

View File

@ -845,15 +845,18 @@ class fpdb:
print "Quitting normally" print "Quitting normally"
# TODO: check if current settings differ from profile, if so offer to save or abort # TODO: check if current settings differ from profile, if so offer to save or abort
if self.db.backend==self.db.MYSQL_INNODB: if self.db!=None:
try: 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: if self.db is not None and self.db.connected:
self.db.disconnect() self.db.disconnect()
except _mysql_exceptions.OperationalError: # oh, damn, we're already disconnected
pass
else: else:
if self.db is not None and self.db.connected: pass
self.db.disconnect()
self.statusIcon.set_visible(False) self.statusIcon.set_visible(False)
self.window.destroy() # explicitly destroy to allow child windows to close cleanly self.window.destroy() # explicitly destroy to allow child windows to close cleanly