quart icon indicating copy to clipboard operation
quart copied to clipboard

Removal of `_request_ctx_stack` broke Flask-Login

Open nirvana-msu opened this issue 3 years ago • 4 comments

The recent commit which removed _request_ctx_stack broke Flask-Login which imports it here. It shouldn't be, as it is clearly meant to be private, but it does... and it used to work before this commit.

May want to re-consider removing if you'd like to keep compatibility.

nirvana-msu avatar Jul 09 '22 23:07 nirvana-msu

We are deprecating the context stacks in favor of a more efficient implementation of tracking current contexts. In Flask, we kept a simple proxy that still allows _request_ctx_stack.top, but it will show a deprecation warning and eventually be removed, so Flask-Login *and other extensions that use the stack top) will need to change.

davidism avatar Jul 09 '22 23:07 davidism

Sure, that makes sense. But to keep Quart aligned it should do the same (i.e. _request_ctx_stack should still be available for now, even if with a warning).

nirvana-msu avatar Jul 09 '22 23:07 nirvana-msu

This nicely touches on a few things which I'll outline, but we can add the shim if required.

Firstly Quart has not yet reached version 1, which means I'm happy to directly remove rather than deprecate then remove things. This said I think the next release should in effect be a version 1 pre release and if everything goes well the subsequent release be version 1.

Next I'd advise you switch to Quart-Auth from Flask-Login, as the former is designed to work with Quart. I'm also not convinced the flask-patching system is a good idea. I'm tempted to remove it from the core quart package before version one. On a related note I've started a discussion on how extensions can support Flask & Quart, https://github.com/pallets/quart/discussions/157. Discussion welcomed.

Flask-Login is actively maintained so I think it will switch to the new API as Flask and Quart are next released.

pgjones avatar Jul 10 '22 09:07 pgjones

update Flask-Login to the last version - it will start to work

dnikolayev avatar Aug 27 '22 17:08 dnikolayev