Flask-Discord icon indicating copy to clipboard operation
Flask-Discord copied to clipboard

Provide async views support

Open hypergonial opened this issue 4 years ago • 3 comments
trafficstars

Provide support for Flask async views as outlined in https://flask.palletsprojects.com/en/2.0.x/async-await/

Theoretically it should be as easy as adding current_app.ensure_sync(func) to decorators, so I tried adding it myself, but I faced issues, which seemed to boil down to it working on the first loading of the site, but after any refresh or navigating to a different page with @requires_authorization the site would just crash.

Thanks!

hypergonial avatar Jul 09 '21 05:07 hypergonial

I have this on my todo list and will try providing support for flask async-await soon. What you tried changing isn't enough. It will also require to make async requests using aiohttp. So, it will be somehow similar to quart-discord patch but for Flask.

weibeu avatar Jul 09 '21 18:07 weibeu

Hmm... I see... Thanks!

hypergonial avatar Jul 10 '21 05:07 hypergonial

If you still need the enhancement I made a PR here : https://github.com/weibeu/Flask-Discord/pull/72

That should fix at least the @requires_authorization

tdev-be avatar Mar 20 '23 13:03 tdev-be