def load_apps():
"""load apps into myapps global dictionary"""
global myapps, default_app
# Connect to DB
result = db().select(apps.ALL)
myapps = {}
for row in result:
name = row['name']
appid = row['id']
preprocess = row['preprocess']
postprocess = row['postprocess']
input_format = row['input_format']
try:
print 'loading: %s (id: %s)' % (name, appid)
myapps[name] = app_instance(input_format, name, preprocess, postprocess)
myapps[name].appid = appid
myapps[name].input_format = input_format
except:
exc_type, exc_value, exc_traceback = sys.exc_info()
print traceback.print_exception(exc_type, exc_value, exc_traceback)
print 'ERROR: LOADING: %s (ID: %s) FAILED TO LOAD' % (name, appid)
default_app = name # simple soln - use last app read from DB
return True
评论列表
文章目录