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.pylonsproject.org/projects/webob/en/stable/api/webob.html#webob.acceptparse.AcceptLanguageValidHeader.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'
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'