Skip to content
This repository has been archived by the owner on Jul 21, 2022. It is now read-only.

Expands wants request to class, removes request from classes #45

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

justanr
Copy link
Owner

@justanr justanr commented Apr 28, 2019

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

@coveralls
Copy link

coveralls commented Apr 28, 2019

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 Coverage Status
Change from base Build 221: 0.1%
Covered Lines: 337
Relevant Lines: 343

💛 - Coveralls

@sh4nks sh4nks mentioned this pull request Apr 29, 2019
2 tasks
@sh4nks
Copy link

sh4nks commented May 22, 2019

Any chance to get this PR merged and a new version pushed to PyPI? :-)

@justanr
Copy link
Owner Author

justanr commented Jun 1, 2019

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.

@DonDebonair
Copy link

Any chance for this to get merged and v1 being pushed to PyPI? :)

@sh4nks
Copy link

sh4nks commented Jun 4, 2020

ping @justanr

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants