• 
      

    Add generic view mixins for Local Site, Profile, and Login Required checks.

    Review Request #8999 — Created June 6, 2017 and submitted — Latest diff uploaded

    Information

    Review Board
    release-3.0.x
    94def46...

    Reviewers

    We have decorators that check if a user has access to a Local Site and
    to check if a user must be authenticated to access a particular view
    (based on siteconfig settings). When working with generic views, it's a
    bit annoying to use those, as it requires creating a dispatch() method
    and using method_decorator() with each of the decorators.

    This change introduces four new mixins that apply these decorators to the
    view, simplifying the view's responsibilities:

    • CheckLocalSiteAccessViewMixin is a convenience around the
      @check_local_site decorator
    • UserProfileRequiredViewMixin is a convenience around the
      @valid_prefs_required decorator, and
    • CheckLoginRequiredViewMixin is a convenience around the
      @check_login_required decorator.
    • LoginRequiredViewMixin is a convenience around the
      @login_required decorator.

    These will be used in some view conversion work that's being done
    separately.

    Tested these in the view work I'm doing.

    Unit tests pass.