Change middleware to always be new-style.

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

david
Djblets
release-3.x
djblets

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
Change middleware to always be new-style.
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)
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     

    Might as well make this one statement now.

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

    Type/description needs to be indented.

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

    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)
     
     
     

    Summary should be on the """ line.

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

    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...