Ticket #393 (closed defect: fixed)
WebOb Accept-Language prefix matching
| Reported by: | davisp | Owned by: | maluke |
|---|---|---|---|
| Priority: | normal | Milestone: | 1.4.1 |
| Component: | webob | Version: | svn-trunk |
| Severity: | normal | Keywords: | |
| Cc: |
Description
As near as I can tell, webob's accept-language matching isn't quite following the spec with respect to picking a quality when a prefix match is required.
From http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.4
'A language-range matches a language-tag if it exactly equals the tag, or if it exactly equals a prefix of the tag such that the first tag character following the prefix is "-".'
An example:
import webob
req = webob.Request.blank('/')
req.accept_language = 'en;q=0.5'
lang = req.accept_language.best_match(['en-gb'])
assert lang is 'en', "%r" % lang
And the assert fails with lang == None.
Though I could be completely misreading the spec.
Change History
Note: See
TracTickets for help on using
tickets.
