Add response callback to _invoke_one_plugin().

Change the response list argument to _invoke_one_plugin()
to a callback that accepts the response value.

Signed-off-by: Doug Hellmann <doug.hellmann@dreamhost.com>
This commit is contained in:
Doug Hellmann 2012-08-21 11:35:05 -04:00
parent 79bd21f43d
commit a9de3ecc55

@ -100,12 +100,12 @@ class ExtensionManager(object):
raise RuntimeError('No %s extensions found' % self.namespace)
response = []
for e in self.extensions:
self._invoke_one_plugin(response, func, e, args, kwds)
self._invoke_one_plugin(response.append, func, e, args, kwds)
return response
def _invoke_one_plugin(self, response, func, e, args, kwds):
def _invoke_one_plugin(self, response_callback, func, e, args, kwds):
try:
response.append(func(e, *args, **kwds))
response_callback(func(e, *args, **kwds))
except Exception as err:
# FIXME: Provide an argument to control
# whether to ignore exceptions in each