Deprecation Warnings for acceptparse
| Affects | Status | Importance | Assigned to | Milestone | |
|---|---|---|---|---|---|
| tacker |
Fix Released
|
Undecided
|
Unassigned | ||
Bug Description
The following warnings are emitted many times during unittest.
/opt/stack/
warnings.warn(
/opt/stack/
warnings.warn(
/opt/stack/
This happens because webob emits a warning for this method for the reason that its algorithm does not conform to RFC 7231.
Need to use `acceptable_offers` for `accept` and `lookup` for `accept_language`, respectively (c.f., https:/
| Changed in tacker: | |
| status: | New → In Progress |
As described in [1], best_match and lookup behave differently and are not replaceable directly. This difference might affect users, and thus leaving the current code is a better choice.
[1] https:/ /docs.pylonspro ject.org/ projects/ webob/en/ stable/ api/webob. html#webob. acceptparse. AcceptLanguageV alidHeader. best_match
----
In [29]: from webob import Request
In [30]: req = Request. blank(' /test?check= a&check= b&name= Bob')
In [31]: req.accept_language = 'en-gb;q=1, en;q=0.8'
In [32]: all_languages = ['en_US']
In [33]: req.accept_ language. best_match( all_languages)
Out[33]: 'en_US'
In [35]: req.accept_ language. lookup( all_languages, default='ja_JP')
Out[35]: 'ja_JP'