Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

consolidate AcceptLanguageXXXHeader classes into the single AcceptLanguage class #463

Open
wants to merge 1 commit into
base: simplify-accept-encoding-parsing
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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