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

Allow wildcards to be used when comparing a MIMEAccept against an offer #185

Merged
merged 2 commits into from
Jan 29, 2016

Conversation

ltvolks
Copy link
Contributor

@ltvolks ltvolks commented Jan 14, 2015

Primary motivation is to address Pylons/pyramid#1407, which would enable usage of wildcards as an accept predicate:

@view_config(accept='text/*')
def view(request):
    ...

Webob.acceptparse.MIMEAccept now supports the following, where previously an exception was raised:

>>> accept = MIMEAccept('text/html')
>>> 'text/*' in accept
True
>>> '*/html' in accept
True
>>> '*' in accept
True

@digitalresistor
Copy link
Member

Would you be so kind as to add some extra tests that would add coverage for the changes, that would be fantastic.

- Use list comprehension instead of map for minor performance gain in
  ``MIMEAccept.parse``
- Fixes Pylons#155
@ltvolks
Copy link
Contributor Author

ltvolks commented Mar 23, 2015

Here you go... Curiously, webob.util only shows 91% coverage against master when I run coverage locally, but Travis seems happy enough.

@digitalresistor
Copy link
Member

I'll work on any other coverage issues once I get this pulled in, thanks for updating this PR with tests. :-)

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

Successfully merging this pull request may close these issues.

Accept matching against wildcard offers is not allowed
2 participants