Issue #10 resolved

Wrong "best_math" for Accept-* header

Anonymous 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. Anonymous

    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. Log in to comment