Set the extension instance early enough for admin registration.

Review Request #12236 — Created April 18, 2022 and submitted

Information

Djblets
release-2.x

Reviewers

When initializing an extension, we set extension_cls.instance to the
initialized extension, but we do this after some extension-supplied code
(the administration site setup) is run. This causes such code to fail
with either instance being an invalid attribute or being None,
depending on any prior initialization.

We now set this alongside storing the extension instance in the manager,
ensuring that there's always consistency between looking up an extension
via the extension manager and via the instance attribute.

Unit tests pass.

Summary ID
Set the extension instance early enough for admin registration.
When initializing an extension, we set `extension_cls.instance` to the initialized extension, but we do this after some extension-supplied code (the administration site setup) is run. This causes such code to fail with either `instance` being an invalid attribute or being `None`, depending on any prior initialization. We now set this alongside storing the extension instance in the manager, ensuring that there's always consistency between looking up an extension via the extension manager and via the `instance` attribute.
cdb27b475cebce4100c21e6e56611d8b31ea097e
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-2.x (440c089)