flask-allows
flask-allows copied to clipboard
Expands wants request to class, removes request from classes
Considering just making this the 1.0 release.
Expands wants_request to also work on subclasses of Requirement rather than just functions:
from flask_allows.requirements import wants_request
@wants_request
class OldKindOfRequirement(Requirement):
def fulfill(self, user, request):
return True
This adds a __call__ method at the front of the MRO that accepts user and request.
In combination with this change, Requirement.__call__ has been changed to only accept user. This change includes conditional requirements, which now only accept user but still use _call_requirement under the hood to compensate for functions and classes that still expect request to be passed but haven't been decorated with wants_request
wants_request will also become a permanent member of the public API since injecting the request into requirements is still useful for some instances and not having to depend on it statically is nice. _call_requirement will removed in the 1.0 release in place of wants_request
Pull Request Test Coverage Report for Build 253
- 23 of 23 (100.0%) changed or added relevant lines in 2 files are covered.
- No unchanged relevant lines lost coverage.
- Overall coverage increased (+0.1%) to 97.317%
| Totals | |
|---|---|
| Change from base Build 221: | 0.1% |
| Covered Lines: | 337 |
| Relevant Lines: | 343 |
💛 - Coveralls
Any chance to get this PR merged and a new version pushed to PyPI? :-)
Sorry to be so radio silent on this. There's been a lot going on in my personal life that's blocked this from being merged. It'll be the beginning/middle of July before I can get back to this.
Sorry guys.
Any chance for this to get merged and v1 being pushed to PyPI? :)
ping @justanr