Change middleware to always be new-style.

Review Request #11961 — Created Jan. 21, 2022 and submitted

Information

Djblets
release-3.x

Reviewers

With Djblets 3.x using only Django 3.2+, we no longer need to deal with
old-style middleware or the MIDDLEWARE_CLASSES setting. This change
updates things to always use the new style.

Ran unit tests.

Summary ID
Change middleware to always be new-style.
With Djblets 3.x using only Django 3.2+, we no longer need to deal with old-style middleware or the MIDDLEWARE_CLASSES setting. This change updates things to always use the new style. Testing Done: Ran unit tests.
ea7313b1e56df9c3bd332bd1f1388980025b6782
Description From Last Updated

E501 line too long (82 > 79 characters)

reviewbotreviewbot

Might as well make this one statement now.

chipx86chipx86

Type/description needs to be indented.

chipx86chipx86

This can be: middleware = list(reversed(self._middleware_classes))

chipx86chipx86

Summary should be on the """ line.

chipx86chipx86

No need for parens here.

chipx86chipx86
Checks run (1 failed, 1 succeeded)
flake8 failed.
JSHint passed.

flake8

david
chipx86
  1. 
      
  2. djblets/extensions/extension.py (Diff revision 2)
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    Show all issues

    Might as well make this one statement now.

  3. djblets/extensions/middleware.py (Diff revision 2)
     
     
     
     
    Show all issues

    Type/description needs to be indented.

  4. djblets/extensions/middleware.py (Diff revision 2)
     
     
     
     
     
     
     
    Show all issues

    This can be:

    middleware = list(reversed(self._middleware_classes))
    
  5. djblets/extensions/middleware.py (Diff revision 2)
     
     

    Out of curiosity, why not just keep this? Seems it was useful for keeping the other functions simple.

    1. It could still be used for process_view and process_exception, but process_template_response actually has different semantics (so our use of this method was incorrect before). Given that it would only be used for two things, the crazy abstraction involved with this just felt like being fancy and complex without much benefit.

  6. djblets/extensions/middleware.py (Diff revision 2)
     
     
     
    Show all issues

    Summary should be on the """ line.

  7. djblets/integrations/manager.py (Diff revision 2)
     
     
    Show all issues

    No need for parens here.

  8. 
      
david
chipx86
  1. Ship It!
  2. 
      
david
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-3.x (eed78df)
Loading...