clean up exception handling in Configuration and imports in GuiGraphViewer
This commit is contained in:
parent
bcecf643f2
commit
ba1513847b
|
@ -316,8 +316,8 @@ class Config:
|
||||||
|
|
||||||
# Parse even if there was no real config file found and we are using the example
|
# 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
|
# If using the example, we'll edit it later
|
||||||
|
log.info("Reading configuration file %s" % file)
|
||||||
try:
|
try:
|
||||||
log.info("Reading configuration file %s" % (file))
|
|
||||||
doc = xml.dom.minidom.parse(file)
|
doc = xml.dom.minidom.parse(file)
|
||||||
except:
|
except:
|
||||||
log.error("Error parsing %s. See error log file." % (file))
|
log.error("Error parsing %s. See error log file." % (file))
|
||||||
|
@ -353,20 +353,22 @@ class Config:
|
||||||
for db_node in doc.getElementsByTagName("database"):
|
for db_node in doc.getElementsByTagName("database"):
|
||||||
try:
|
try:
|
||||||
db = Database(node = db_node)
|
db = Database(node = db_node)
|
||||||
|
except:
|
||||||
|
raise FpdbError("Unable to create database object")
|
||||||
|
else:
|
||||||
if db.db_name in self.supported_databases:
|
if db.db_name in self.supported_databases:
|
||||||
raise FpdbError("Database names must be unique")
|
raise FpdbError("Database names must be unique")
|
||||||
# If there is only one Database node, or none are marked default, the first is selected
|
# If there is only one Database node, or none are marked
|
||||||
if len(self.supported_databases) == 0:
|
# default, use first
|
||||||
|
if not self.supported_databases:
|
||||||
self.db_selected = db.db_name
|
self.db_selected = db.db_name
|
||||||
self.supported_databases[db.db_name] = db
|
self.supported_databases[db.db_name] = db
|
||||||
if db.db_selected:
|
if db.db_selected:
|
||||||
self.db_selected = db.db_name
|
self.db_selected = db.db_name
|
||||||
except:
|
|
||||||
raise
|
|
||||||
if dbname and dbname in self.supported_databases:
|
if dbname and dbname in self.supported_databases:
|
||||||
self.db_selected = dbname
|
self.db_selected = dbname
|
||||||
|
|
||||||
|
|
||||||
# s_dbs = doc.getElementsByTagName("mucked_windows")
|
# s_dbs = doc.getElementsByTagName("mucked_windows")
|
||||||
for aw_node in doc.getElementsByTagName("aw"):
|
for aw_node in doc.getElementsByTagName("aw"):
|
||||||
aw = Aux_window(node = aw_node)
|
aw = Aux_window(node = aw_node)
|
||||||
|
@ -535,6 +537,7 @@ class Config:
|
||||||
def get_db_parameters(self):
|
def get_db_parameters(self):
|
||||||
db = {}
|
db = {}
|
||||||
name = self.db_selected
|
name = self.db_selected
|
||||||
|
# TODO: What's up with all the exception handling here?!
|
||||||
try: db['db-databaseName'] = name
|
try: db['db-databaseName'] = name
|
||||||
except: pass
|
except: pass
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ try:
|
||||||
from matplotlib.backends.backend_gtkagg import NavigationToolbar2GTKAgg as NavigationToolbar
|
from matplotlib.backends.backend_gtkagg import NavigationToolbar2GTKAgg as NavigationToolbar
|
||||||
from numpy import arange, cumsum
|
from numpy import arange, cumsum
|
||||||
from pylab import *
|
from pylab import *
|
||||||
except:
|
except ImportError:
|
||||||
print """Failed to load libs for graphing, graphing will not function. Please in
|
print """Failed to load libs for graphing, graphing will not function. Please in
|
||||||
stall numpy and matplotlib if you want to use graphs."""
|
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
|
print """This is of no consequence for other parts of the program, e.g. import
|
||||||
|
|
Loading…
Reference in New Issue
Block a user