Wrong "best_math" for Accept-* header

Create issue
Issue #10 resolved
Former user created an issue

According to RFC: "If a parameter has a quality value of 0, then content with this parameter is `not acceptable' for the client." but unfortunately acceptparse.Accept does not conform that rule :(

Eg.:

Accept( 'Accept-Encoding', 'deflate, *;q=0' ).best_match( ['foo'] )

Returns "foo" instead of default value.

Comments (6)

  1. Former user Account Deleted

    Hope it will be sufficient :-)

    <pre>

    1. !/usr/bin/env python
    2. -*- coding: utf-8 -*- from webob.acceptparse import Accept

    if 'main' == name: assert Accept('Accept-Encoding', 'bar, *;q=0').best_match( [ 'foo' ], 'baz' ) == 'baz' </pre>

  2. Sergey Schetinin

    You can wrap code like this: {{{code}}} There's a button in the comment form for that too.

  3. Log in to comment