Add a base extension hook for managing multiple items in a registry.

Review Request #9283 — Created Oct. 18, 2017 and submitted

chipx86
Djblets
release-0.10.x
d33831d...
djblets

This introduces BaseRegistryMultiItemHook, which is similar to
BaseRegistryHook but handles registering/unregistering a list of items
at once. It's useful for extension hooks that otherwise need to manage
multiple items, helping to consolidate that logic.

Unlike existing hooks in Review Board that manage multiple items, this
is also careful to unregister any items that were registered upon
encountering an error, so that some items don't remain permanently
registered even if the extension is shut down.

Unit tests were added for this hook.

Unit tests pass.

Moved some extension hooks to this in Review Board and ran tests. Those
also pass.

Description From Last Updated

Should we log something here?

daviddavid
david
  1. 
      
  2. djblets/extensions/hooks.py (Diff revision 1)
     
     

    Should we log something here?

    1. It'll get re-raised to the caller, which is the same behavior as other registry-based hooks.

  3. 
      
david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-0.10.x (195d209)
Loading...