Move and reorganize LocalSite and OAuth2 signal handlers.
Review Request #12299 — Created May 24, 2022 and submitted
reviewboard.site
had previously started listening to signals in two
places:
- The top-level
reviewboard.site
module, for managing OAuth2
application access.reviewboard.models
, for triggering alocal_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
centralconnect_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 oninitializing
, 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.