clean up exception handling in Configuration and imports in GuiGraphViewer

This commit is contained in:
Eric Blade 2009-09-15 23:30:59 -05:00
parent bcecf643f2
commit ba1513847b
2 changed files with 10 additions and 7 deletions

View File

@ -316,8 +316,8 @@ class Config:
# Parse even if there was no real config file found and we are using the example
# If using the example, we'll edit it later
log.info("Reading configuration file %s" % file)
try:
log.info("Reading configuration file %s" % (file))
doc = xml.dom.minidom.parse(file)
except:
log.error("Error parsing %s. See error log file." % (file))
@ -353,20 +353,22 @@ class Config:
for db_node in doc.getElementsByTagName("database"):
try:
db = Database(node = db_node)
except:
raise FpdbError("Unable to create database object")
else:
if db.db_name in self.supported_databases:
raise FpdbError("Database names must be unique")
# If there is only one Database node, or none are marked default, the first is selected
if len(self.supported_databases) == 0:
# If there is only one Database node, or none are marked
# default, use first
if not self.supported_databases:
self.db_selected = db.db_name
self.supported_databases[db.db_name] = db
if db.db_selected:
self.db_selected = db.db_name
except:
raise
if dbname and dbname in self.supported_databases:
self.db_selected = dbname
# s_dbs = doc.getElementsByTagName("mucked_windows")
for aw_node in doc.getElementsByTagName("aw"):
aw = Aux_window(node = aw_node)
@ -535,6 +537,7 @@ class Config:
def get_db_parameters(self):
db = {}
name = self.db_selected
# TODO: What's up with all the exception handling here?!
try: db['db-databaseName'] = name
except: pass

View File

@ -32,7 +32,7 @@ try:
from matplotlib.backends.backend_gtkagg import NavigationToolbar2GTKAgg as NavigationToolbar
from numpy import arange, cumsum
from pylab import *
except:
except ImportError:
print """Failed to load libs for graphing, graphing will not function. Please in
stall numpy and matplotlib if you want to use graphs."""
print """This is of no consequence for other parts of the program, e.g. import