Opened 3 weeks ago

Last modified 8 days ago

#37178 assigned Cleanup/optimization

Move MiddlewareMixin out of utils.deprecation

Reported by: Jacob Walls Owned by: CharulL00
Component: HTTP handling Version: dev
Severity: Normal Keywords:
Cc: Farhan Ali, Jake Howard, Carlton Gibson Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

Following some mastodon chatter kicked off by Farhan last fall, Carlton replied with an answer about why MiddlewareMixin lives under utils.deprecation:

I think it was meant to go away as we all moved to function based middleware. Then that never happened. Then MiddlewareMixin grew the async adaption two-step, and it’s useful for that. Even if we just use it internally, it should probably be moved. (Clean code and all that Jazz)

We have some +1s on that Mastodon thread, ending with "if a fellow picks it up", so here I am, proposing to move it :-)

We could choose to leave a single alias in utils.deprecation to avoid breaking changes for people explicitly importing MiddlewareMixin. It's a lot simpler than adding a release note or a deprecation path. (I might be in the minority with this view, though.)

Change History (9)

comment:1 by Carlton Gibson, 3 weeks ago

Triage Stage: UnreviewedAccepted

OK, yep. Nice hustle.

Deprecation could use a module level __getattr__ to raise the DeprecationWarning. 🤔

comment:2 by CharulL00, 3 weeks ago

Owner: set to CharulL00
Status: newassigned

I’m claiming this ticket and will work on a patch.

comment:3 by CharulL00, 3 weeks ago

Has patch: set
Last edited 3 weeks ago by CharulL00 (previous) (diff)

comment:4 by CharulL00, 3 weeks ago

Has patch: unset

comment:5 by CharulL00, 3 weeks ago

Has patch: set
Version 0, edited 3 weeks ago by CharulL00 (next)

in reply to:  1 comment:6 by Mike Edmunds, 3 weeks ago

Replying to Carlton Gibson:

[...] Deprecation could use a module level __getattr__ to raise the DeprecationWarning. 🤔

It probably should. In the past, retaining multiple supported import paths to things that move has been considered a maintenance burden, and deprecating the old path was preferred. (Trying to remember the specific example where this came up.)

comment:7 by Mike Edmunds, 3 weeks ago

Patch needs improvement: set

comment:8 by CharulL00, 12 days ago

Patch needs improvement: unset

comment:9 by Mike Edmunds, 8 days ago

Triage Stage: AcceptedReady for checkin
Note: See TracTickets for help on using tickets.
Back to Top