Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added helper function and request contains #208

Merged
merged 2 commits into from
Jul 1, 2018
Merged

Conversation

josephmancuso
Copy link
Member

@josephmancuso josephmancuso commented Jun 30, 2018

Added a new method to the request: request.contains()

This method can be used like:

# Request: /dashboard/user/edit
def show(self, request: Request):
    if request.contains('/dashboard/user/*'):
        pass

or you can be more explicit:

# Request: /dashboard/user/edit/1
def show(self, request: Request):
    if request.contains('/dashboard/user/edit/*:int'):
        pass

which will match /dashboard/user/edit/1 but not /dashboard/user/edit/joe which is very similar to the matching of the route urls

or

# Request: /dashboard/user/edit/1
def show(self, request: Request):
    if request.contains('/dashboard/user/*:string/*:int'):
        pass

which will match /dashboard/user/edit/1 and /dashboard/user/create/1

#200

@josephmancuso josephmancuso self-assigned this Jun 30, 2018
@josephmancuso josephmancuso added the next minor Issue scheduled for the next minor release label Jun 30, 2018
@coveralls
Copy link

coveralls commented Jun 30, 2018

Coverage Status

Coverage increased (+0.1%) to 91.234% when pulling b702165 on add-is-to-request into e845591 on master.

@josephmancuso josephmancuso changed the title added helper and request contains added helper function and request contains Jun 30, 2018
@josephmancuso josephmancuso added the enhancement New feature or request label Jun 30, 2018
@josephmancuso josephmancuso merged commit 7dbb550 into master Jul 1, 2018
@josephmancuso josephmancuso deleted the add-is-to-request branch July 11, 2018 12:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request next minor Issue scheduled for the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants