Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Flask OAuth object doesn't use cache if cache object is not truthy #98
This is a bit of a corner case, and I'm not 100% sure I've diagnosed it correctly, so here's the background:
We are building a Flask-based login system based on loginpass and Twitter (OAuth1). I found that it would work if the flask.client.OAuth object were passed the a Cache object as implemented in the loginpass examples. But it would fail, with
After a while, I determined that I could make this class work by ensuring that it was always truthy:
This seems plausible. I see a few places in the code base that test
If the tests of cache's truthiness are just to distinguish it from None, perhaps a test against None can be substituted. Or if there is something about the cache that this test is supposed to reveal, that can be better documented. All I saw was a description of the methods that cache should support.
This behavior is seen on Python 3.7 with Flask 1.0.2, loginpass 0.2.1, and Authlib 0.10.