• 
      

    Move and reorganize LocalSite and OAuth2 signal handlers.

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

    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.

    Summary ID
    Move and reorganize LocalSite and OAuth2 signal handlers.
    `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.
    6c02a68b4fce8f51defdc4cb69ad2db8842cfdc1
    Description From Last Updated

    Module docstring?

    daviddavid

    Typo with the space after pk_set.

    daviddavid
    david
    1. 
        
    2. reviewboard/oauth/signal_handlers.py (Diff revision 1)
       
       
      Show all issues

      Module docstring?

    3. reviewboard/oauth/signal_handlers.py (Diff revision 1)
       
       
      Show all issues

      Typo with the space after pk_set.

    4. 
        
    chipx86
    david
    1. Ship It!
    2. 
        
    chipx86
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to release-5.0.x (5191e9b)