Skip to content

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

Merged
digitalresistor merged 2 commits into
Pylons:masterfrom
ltvolks:155-accept-wildcard
Jan 29, 2016
Merged

Allow wildcards to be used when comparing a MIMEAccept against an offer#185
digitalresistor merged 2 commits into
Pylons:masterfrom
ltvolks:155-accept-wildcard

Conversation

@ltvolks

@ltvolks ltvolks commented Jan 14, 2015

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Member

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

ltvolks added 2 commits March 23, 2015 09:27
- Use list comprehension instead of map for minor performance gain in
  ``MIMEAccept.parse``
- Fixes Pylons#155
@ltvolks ltvolks force-pushed the 155-accept-wildcard branch from 8f49817 to e51a608 Compare March 23, 2015 21:55
@ltvolks

ltvolks commented Mar 23, 2015

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
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