Issue #2729 Fixed error handling in loadPreferences method of loadConfig.py
Change-Id: Ic01c265f792d855751aeac9890953600d531c12c Former-commit-id:8da64048e7
[formerly cfec08f8c4ac8552699e9387148ba2e9d0dc9558] Former-commit-id:69cd6a1598
This commit is contained in:
parent
e7979a0b8f
commit
dde9253f15
1 changed files with 13 additions and 8 deletions
|
@ -26,8 +26,8 @@
|
|||
#
|
||||
# Date Ticket# Engineer Description
|
||||
# ------------ ---------- ----------- --------------------------
|
||||
# 12/11/09 njensen Initial Creation.
|
||||
#
|
||||
# 12/11/09 njensen Initial Creation.
|
||||
# 04/02/2014 #2729 randerso Fixed error handling in loadPreferences
|
||||
#
|
||||
#
|
||||
|
||||
|
@ -38,18 +38,23 @@ from java.lang import String, Float, Integer, Boolean
|
|||
def loadPreferences(config):
|
||||
try:
|
||||
# import the config file
|
||||
if type(config) is types.StringType:
|
||||
globals = loadConfig(config)
|
||||
elif type(config) is types.ModuleType:
|
||||
globals = getGlobals(config)
|
||||
if type(config) is types.StringType:
|
||||
configName = config
|
||||
mod = __import__(config)
|
||||
elif type(config) is types.ModuleType:
|
||||
configName = config.__name__
|
||||
mod = config
|
||||
|
||||
globals = getGlobals(mod)
|
||||
|
||||
from com.raytheon.viz.gfe import Activator, PythonPreferenceStore
|
||||
prefs = PythonPreferenceStore(globals)
|
||||
Activator.getDefault().setPreferenceStore(prefs)
|
||||
return prefs
|
||||
except Exception, e:
|
||||
LogStream.logProblem("Unknown or improper config file: ",
|
||||
configFile, " for user: ", userName)
|
||||
import LogStream
|
||||
import traceback
|
||||
LogStream.logProblem("Unknown or invalid config file: %s\n%s" % (configName, traceback.format_exc()))
|
||||
raise Exception, e
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue