singingwolfboy / flask-dance

Doing the OAuth dance with style using Flask, requests, and oauthlib.
https://pypi.python.org/pypi/Flask-Dance/
MIT License
1k stars 157 forks source link

Made fixes to extend compatibility untill Flask 2.3.0 #397

Closed BlitzJB closed 2 years ago

BlitzJB commented 2 years ago

Due to changes from flask 2.2.0, _lookup_app_object which is commonly used across all contrib modules is now depreciated. So i mimicked _lookup_app_object from flask 2.1.3 in flask_dance.utils and changed imports in all contrib modules to import _lookup_app_object from flask_dance.utils instead

codecov[bot] commented 2 years ago

Codecov Report

Merging #397 (4e13d4c) into main (b25e5cb) will decrease coverage by 0.18%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #397      +/-   ##
==========================================
- Coverage   93.52%   93.33%   -0.19%     
==========================================
  Files          35       35              
  Lines        1066     1096      +30     
==========================================
+ Hits          997     1023      +26     
- Misses         69       73       +4     
Impacted Files Coverage Δ
flask_dance/contrib/atlassian.py 100.00% <100.00%> (ø)
flask_dance/contrib/authentiq.py 100.00% <100.00%> (ø)
flask_dance/contrib/azure.py 100.00% <100.00%> (ø)
flask_dance/contrib/digitalocean.py 100.00% <100.00%> (ø)
flask_dance/contrib/discord.py 100.00% <100.00%> (ø)
flask_dance/contrib/dropbox.py 100.00% <100.00%> (ø)
flask_dance/contrib/facebook.py 100.00% <100.00%> (ø)
flask_dance/contrib/fitbit.py 100.00% <100.00%> (ø)
flask_dance/contrib/github.py 100.00% <100.00%> (ø)
flask_dance/contrib/gitlab.py 96.00% <100.00%> (+0.16%) :arrow_up:
... and 16 more

:mega: Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

BlitzJB commented 2 years ago

To comment on the failing checks, they are all depreciation warnings on _app_ctx_stack which i imported from flask.global to use in flask_dance.utils._lookup_app_object, I couldn't think of a more graceful way to achieve the same. If there seem to be, please do let me know and I'll make the changes

BlitzJB commented 2 years ago

This was in response to #396

singingwolfboy commented 2 years ago

Thanks for sending this pull request, but I ended up solving this problem a different way. According to the release notes for Flask 2.2.0, we can and should store information on the flask.g object instead of the _app_ctx_stack object. This also makes the change backwards-compatible for all versions of Flask that Flask-Dance supports.

I implemented that change in #398, so I'm closing this pull request. However, if your goal is compatibility with the latest version of Flask, try installing Flask-Dance 6.1.0, which I just released today with this change. If you have problems, let me know!