Move and reorganize LocalSite and OAuth2 signal handlers.

Review Request #12299 — Created May 24, 2022 and submitted — Latest diff uploaded

Information

Review Board
release-5.0.x

Reviewers

reviewboard.site had previously started listening to signals in two
places:

  1. The top-level reviewboard.site module, for managing OAuth2
    application access.
  2. reviewboard.models, for triggering a local_site_user_added
    signal.

The OAuth2 one probably shouldn't be in this app, and in fact it also
listens to a signal (initializing) to set up webapi scopes.

Since this is a mess, and more signal handlers will soon be coming as
part of another change, this change takes the opportunity to clean this
up.

New reviewboard.site.signal_handlers and
reviewboard.oauth.signal_handlers modules have been added, each with a
central connect_signal_handlers() method.

The one in reviewboard.site sets up the trigger for the
local_site_user_added signal.

The one in reviewboard.oauth sets up the application access management
and enables scope.

Both apps now have an apps.py, which calls
connect_to_signal_handlers() when the app is ready. This means we're
not setting up on initializing, which currently happens on first HTTP
request. Instead, we're setting up when the app is ready, meaning we can
be better prepared before HTTP requests are handled.

Unit tests pass.

Commits

Files