avoid crash due to plugin code at all cost

svn: r20376
This commit is contained in:
Benny Malengier 2012-09-13 12:01:55 +00:00
parent 516916cb5c
commit 4848aaaa7d

View File

@ -1924,6 +1924,10 @@ def get_available_views():
mod = pmgr.load_plugin(pdata) mod = pmgr.load_plugin(pdata)
if not mod or not hasattr(mod, pdata.viewclass): if not mod or not hasattr(mod, pdata.viewclass):
#import of plugin failed #import of plugin failed
try:
lasterror = pmgr.get_fail_list()[-1][1][1]
except:
lasterror = '*** No error found, probably error in gpr.py file ***'
ErrorDialog( ErrorDialog(
_('Failed Loading View'), _('Failed Loading View'),
_('The view %(name)s did not load and reported an error.\n\n' _('The view %(name)s did not load and reported an error.\n\n'
@ -1937,7 +1941,7 @@ def get_available_views():
'name': pdata.name, 'name': pdata.name,
'firstauthoremail': pdata.authors_email[0] if 'firstauthoremail': pdata.authors_email[0] if
pdata.authors_email else '...', pdata.authors_email else '...',
'error_msg': pmgr.get_fail_list()[-1][1][1]}) 'error_msg': lasterror})
continue continue
viewclass = getattr(mod, pdata.viewclass) viewclass = getattr(mod, pdata.viewclass)