Handle exceptions in a way that doesn't make python 2.5 really angry

This commit is contained in:
Chris Jones 2009-12-30 01:50:47 +00:00
parent 714425dfbe
commit a13581a4c8
3 changed files with 4 additions and 4 deletions

View File

@ -85,7 +85,7 @@ class PluginRegistry(borg.Borg):
if item not in self.instances: if item not in self.instances:
func = getattr(module, item) func = getattr(module, item)
self.instances[item] = func() self.instances[item] = func()
except Exception as e: except Exception, e:
err('PluginRegistry::load_plugins: Importing plugin %s \ err('PluginRegistry::load_plugins: Importing plugin %s \
failed: %s' % (plugin, e)) failed: %s' % (plugin, e))

View File

@ -228,7 +228,7 @@ class Terminal(gtk.VBox):
self.matches[name] = self.vte.match_add(match) self.matches[name] = self.vte.match_add(match)
dbg('Terminal::update_matches: added plugin URL handler \ dbg('Terminal::update_matches: added plugin URL handler \
for %s (%s)' % (name, urlplugin.__class__.__name__)) for %s (%s)' % (name, urlplugin.__class__.__name__))
except Exception as ex: except Exception, ex:
err('Terminal::update_url_matches: %s' % ex) err('Terminal::update_url_matches: %s' % ex)
def connect_signals(self): def connect_signals(self):
@ -895,7 +895,7 @@ for %s (%s)' % (name, urlplugin.__class__.__name__))
%s plugin' % urlplugin.handler_name) %s plugin' % urlplugin.handler_name)
url = newurl url = newurl
break; break;
except Exception as ex: except Exception, ex:
err('Terminal::prepare_url: %s' % ex) err('Terminal::prepare_url: %s' % ex)
return(url) return(url)

View File

@ -166,7 +166,7 @@ class TerminalPopupMenu(object):
menuplugin.callback(menuitems, menu, terminal) menuplugin.callback(menuitems, menu, terminal)
for menuitem in menuitems: for menuitem in menuitems:
menu.append(menuitem) menu.append(menuitem)
except Exception as ex: except Exception, ex:
err('TerminalPopupMenu::show: %s' % ex) err('TerminalPopupMenu::show: %s' % ex)
menu.show_all() menu.show_all()