Skip to content

Commit

Permalink
consolidate AcceptLanguageXXXHeader classes into the single AcceptLan…
Browse files Browse the repository at this point in the history
…guage class
  • Loading branch information
mmerickel committed Mar 3, 2024
1 parent d19faa7 commit 27394cf
Show file tree
Hide file tree
Showing 5 changed files with 493 additions and 1,647 deletions.
37 changes: 37 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@ Feature
``acceptable_offers``. See backward incompatibilities below.
See https://github.com/Pylons/webob/pull/462

- Consolidation of ``AcceptLanguage`` header handling into a single class.
See backward incompatibilities below for more information.
See https://github.com/Pylons/webob/pull/463

- ``webob.acceptparse.AcceptLanguage.__contains__`` is undeprecated and its
logic is made consistent with the ``basic_filtering`` algorithm.
See backward incompatibilities below.
See https://github.com/Pylons/webob/pull/463

Compatibility
~~~~~~~~~~~~~

Expand Down Expand Up @@ -114,6 +123,34 @@ Backwards Incompatibilities

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

- Remove ``AcceptLanguageValidHeader``, ``AcceptLanguageNoHeader`` and
``AcceptLanguageInvalidHeader``. These classes are consolidated into
``AcceptLanguage`` with a ``header_state`` attribute for users that need
to know the state of the header.
See https://github.com/Pylons/webob/pull/463

- Remove previously-deprecated ``webob.acceptparse.AcceptLanguage`` methods
``__iter__``, ``best_match`` and ``quality``. Look at using
``basic_filtering`` and ``lookup`` methods instead that implement
RFC-compliant algorithms for language negotiation.
See https://github.com/Pylons/webob/pull/463

- ``webob.acceptparse.AcceptLanguage.basic_filtering`` now considers supplied
language tags to all match with quality 1.0 if the header itself is missing
or invalid.
See https://github.com/Pylons/webob/pull/463

- ``webob.acceptparse.AcceptEncoding.__contains__`` method is now a thin
wrapper around ``basic_filtering`` which modifies their behavior slightly:

- A tuple can no longer be an offer containing server-side quality values.
- An offer will only match a ``*`` clause in a header if it does not match
any other clauses.
- The ``identity`` offer was not properly considered a match unless the
header explicitly it excluded via ``*;q=0`` or ``identity;q=0``.

See https://github.com/Pylons/webob/pull/463

Experimental Features
~~~~~~~~~~~~~~~~~~~~~

Expand Down
20 changes: 3 additions & 17 deletions docs/api/webob.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,23 +47,9 @@ methods:
acceptable_offers, best_match, quality

.. autoclass:: AcceptLanguage
:members: parse

.. autoclass:: AcceptLanguageValidHeader
:members: header_value, parsed, __init__, __add__, __contains__, __iter__,
__radd__, __str__, parse, basic_filtering, best_match, lookup,
quality

.. autoclass:: AcceptLanguageNoHeader
:members: header_value, parsed, __init__, __add__, __contains__, __iter__,
__radd__, __str__, parse, basic_filtering, best_match, lookup,
quality

.. autoclass:: AcceptLanguageInvalidHeader
:members: header_value, parsed, __init__, __add__, __contains__, __iter__,
__radd__, __str__, parse, basic_filtering, best_match, lookup,
quality

:members:
parse, header_value, parsed, header_state, __init__, __add__,
__bool__, __radd__, __repr__, __str__, copy, basic_filtering, lookup

Cache-Control
~~~~~~~~~~~~~
Expand Down
Loading

0 comments on commit 27394cf

Please sign in to comment.