Merge lp:~stefanor/ibid/handle-plugin-setup-failure-726022 into lp:ibid

Proposed by Stefano Rivera on 2012-07-23
Status: Merged
Approved by: Stefano Rivera on 2012-07-31
Approved revision: 1047
Merged at revision: 1050
Proposed branch: lp:~stefanor/ibid/handle-plugin-setup-failure-726022
Merge into: lp:ibid
Diff against target: 47 lines (+21/-15)
1 file modified
ibid/ (+21/-15)
To merge this branch: bzr merge lp:~stefanor/ibid/handle-plugin-setup-failure-726022
Reviewer Review Type Date Requested Status
Jonathan Hitchcock 2012-07-23 Approve on 2012-07-25
Review via email:

Commit message

Catch Exceptions during Processor instantiation, rather than aborting an entire plugin load ecause of an exception

Description of the change

A single Processor that won't load shouldn't make a plugin unloadable.

To post a comment you must log in.
Jonathan Hitchcock (vhata) wrote :


review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'ibid/'
--- ibid/ 2011-02-27 11:03:47 +0000
+++ ibid/ 2012-07-23 22:42:26 +0000
@@ -235,23 +235,29 @@
235 self.log.exception(u"Couldn't load %s plugin", name)235 self.log.exception(u"Couldn't load %s plugin", name)
236 return False236 return False
238 try:238 for classname, klass in inspect.getmembers(m, inspect.isclass):
239 for classname, klass in inspect.getmembers(m, inspect.isclass):239 if (issubclass(klass, ibid.plugins.Processor)
240 if issubclass(klass, ibid.plugins.Processor) and klass != ibid.plugins.Processor:240 and klass != ibid.plugins.Processor):
241 if (klass.__name__ not in noload and (klass.__name__ in load241 if (klass.__name__ not in noload and (klass.__name__ in load
242 or ((load_all or klass.autoload) and not noload_all))):242 or ((load_all or klass.autoload) and not noload_all))):
243 self.log.debug("Loading Processor: %s.%s", name, klass.__name__)243 self.log.debug("Loading Processor: %s.%s", name,
244 klass.__name__)
245 try:
244 ibid.processors.append(klass(name))246 ibid.processors.append(klass(name))
245 else:247 except Exception, e:
246 self.log.debug("Skipping Processor: %s.%s", name, klass.__name__)248 self.log.exception(u"Couldn't instantiate %s "
249 u"processor of %s plugin",
250 classname, name)
251 continue
252 else:
253 self.log.debug("Skipping Processor: %s.%s", name,
254 klass.__name__)
248 try:256 try:
249 schema_version_check(ibid.databases['ibid'])257 schema_version_check(ibid.databases['ibid'])
250 except SchemaVersionException, e:258 except SchemaVersionException, e:
251 self.log.error(u'Tables out of date: %s. Run "ibid-db --upgrade"', e.message)259 self.log.error(u'Tables out of date: %s. Run "ibid-db --upgrade"',
252 except Exception, e:260 e.message)
253 self.log.exception(u"Couldn't instantiate %s processor of %s plugin", classname, name)
254 return False
256 ibid.processors.sort(key=lambda x: x.priority)262 ibid.processors.sort(key=lambda x: x.priority)


People subscribed via source and target branches

to all changes: