Skip to content

Commit 27394cf

Browse files
committed
consolidate AcceptLanguageXXXHeader classes into the single AcceptLanguage class
1 parent d19faa7 commit 27394cf

File tree

5 files changed

+493
-1647
lines changed

5 files changed

+493
-1647
lines changed

CHANGES.txt

+37
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,15 @@ Feature
4343
``acceptable_offers``. See backward incompatibilities below.
4444
See https://github.com/Pylons/webob/pull/462
4545

46+
- Consolidation of ``AcceptLanguage`` header handling into a single class.
47+
See backward incompatibilities below for more information.
48+
See https://github.com/Pylons/webob/pull/463
49+
50+
- ``webob.acceptparse.AcceptLanguage.__contains__`` is undeprecated and its
51+
logic is made consistent with the ``basic_filtering`` algorithm.
52+
See backward incompatibilities below.
53+
See https://github.com/Pylons/webob/pull/463
54+
4655
Compatibility
4756
~~~~~~~~~~~~~
4857

@@ -114,6 +123,34 @@ Backwards Incompatibilities
114123

115124
See https://github.com/Pylons/webob/pull/462
116125

126+
- Remove ``AcceptLanguageValidHeader``, ``AcceptLanguageNoHeader`` and
127+
``AcceptLanguageInvalidHeader``. These classes are consolidated into
128+
``AcceptLanguage`` with a ``header_state`` attribute for users that need
129+
to know the state of the header.
130+
See https://github.com/Pylons/webob/pull/463
131+
132+
- Remove previously-deprecated ``webob.acceptparse.AcceptLanguage`` methods
133+
``__iter__``, ``best_match`` and ``quality``. Look at using
134+
``basic_filtering`` and ``lookup`` methods instead that implement
135+
RFC-compliant algorithms for language negotiation.
136+
See https://github.com/Pylons/webob/pull/463
137+
138+
- ``webob.acceptparse.AcceptLanguage.basic_filtering`` now considers supplied
139+
language tags to all match with quality 1.0 if the header itself is missing
140+
or invalid.
141+
See https://github.com/Pylons/webob/pull/463
142+
143+
- ``webob.acceptparse.AcceptEncoding.__contains__`` method is now a thin
144+
wrapper around ``basic_filtering`` which modifies their behavior slightly:
145+
146+
- A tuple can no longer be an offer containing server-side quality values.
147+
- An offer will only match a ``*`` clause in a header if it does not match
148+
any other clauses.
149+
- The ``identity`` offer was not properly considered a match unless the
150+
header explicitly it excluded via ``*;q=0`` or ``identity;q=0``.
151+
152+
See https://github.com/Pylons/webob/pull/463
153+
117154
Experimental Features
118155
~~~~~~~~~~~~~~~~~~~~~
119156

docs/api/webob.txt

+3-17
Original file line numberDiff line numberDiff line change
@@ -47,23 +47,9 @@ methods:
4747
acceptable_offers, best_match, quality
4848

4949
.. autoclass:: AcceptLanguage
50-
:members: parse
51-
52-
.. autoclass:: AcceptLanguageValidHeader
53-
:members: header_value, parsed, __init__, __add__, __contains__, __iter__,
54-
__radd__, __str__, parse, basic_filtering, best_match, lookup,
55-
quality
56-
57-
.. autoclass:: AcceptLanguageNoHeader
58-
:members: header_value, parsed, __init__, __add__, __contains__, __iter__,
59-
__radd__, __str__, parse, basic_filtering, best_match, lookup,
60-
quality
61-
62-
.. autoclass:: AcceptLanguageInvalidHeader
63-
:members: header_value, parsed, __init__, __add__, __contains__, __iter__,
64-
__radd__, __str__, parse, basic_filtering, best_match, lookup,
65-
quality
66-
50+
:members:
51+
parse, header_value, parsed, header_state, __init__, __add__,
52+
__bool__, __radd__, __repr__, __str__, copy, basic_filtering, lookup
6753

6854
Cache-Control
6955
~~~~~~~~~~~~~

0 commit comments

Comments
 (0)