-
Notifications
You must be signed in to change notification settings - Fork 188
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 AcceptXXXHeader classes into Accept #460
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,14 +10,21 @@ Feature | |
|
||
- Add Request.remote_host, exposing REMOTE_HOST environment variable. | ||
|
||
- Added ``acceptparse.Accept.parse_offer`` to codify what types of offers | ||
are compatible with ``acceptparse.AcceptValidHeader.acceptable_offers``, | ||
``acceptparse.AcceptMissingHeader.acceptable_offers``, and | ||
``acceptparse.AcceptInvalidHeader.acceptable_offers``. This API also | ||
normalizes the offer with lowercased type/subtype and parameter names. | ||
- Added ``webob.acceptparse.Accept.parse_offer`` to codify what types of offers | ||
are compatible with ``webob.acceptparse.Accept.acceptable_offers``. This API | ||
also normalizes the offer with lowercased type/subtype and parameter names. | ||
See https://github.com/Pylons/webob/pull/376 and | ||
https://github.com/Pylons/webob/pull/379 | ||
|
||
- Consolidation of ``Accept`` header handling into a single class. | ||
See backward incompatibilities below for more information. | ||
See https://github.com/Pylons/webob/pull/460 | ||
|
||
- ``webob.acceptparse.Accept``, methods ``best_match``, ``quality``, and | ||
``__contains__`` are undeprecated and their logic is made consistent with | ||
``acceptable_offers``. See backward incompatibilities below. | ||
See https://github.com/Pylons/webob/pull/460 | ||
|
||
Compatibility | ||
~~~~~~~~~~~~~ | ||
|
||
|
@@ -27,6 +34,28 @@ Backwards Incompatibilities | |
|
||
- Drop support for Python 2.7, 3.4, 3.5, 3.6, and 3.7. | ||
|
||
- Remove ``AcceptValidHeader``, ``AcceptNoHeader`` and ``AcceptInvalidHeader``. | ||
These classes are consolidated into ``Accept`` with a ``header_state`` | ||
attribute for users that need to know the exact state of the header. | ||
See https://github.com/Pylons/webob/pull/460 | ||
|
||
- Remove previously-deprecated ``webob.acceptparse.MIMEAccept``. | ||
See https://github.com/Pylons/webob/pull/460 | ||
|
||
- Remove previously-deprecated ``webob.acceptparse.Accept.__iter__``. | ||
See https://github.com/Pylons/webob/pull/460 | ||
|
||
- ``webob.acceptparse.Accept`` methods, ``best_match``, ``quality``, and | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would "webob.acceptparse.Accept's methods best_match, ..." be clearer? |
||
``__contains__`` are now thin wrappers around ``acceptable_offers`` which | ||
modifies their behavior slightly: | ||
|
||
- Offers containing wildcards are no longer allowed. | ||
- A tuple can no longer be an offer containing server-side quality values. | ||
- An offer will only match a wildcard clause in the header, such as ``*/*`` | ||
or ``text/*`` if it does not match something more specific. | ||
Comment on lines
+50
to
+55
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I remember correctly, their behaviour has been modified more than slightly: the switch from the old algorithms to the one in (I also had trouble understanding "A tuple can no longer be an offer containing server-side quality values." - is it saying that offers can no longer contain server-side quality values?) (The same text is used in the docstrings of |
||
|
||
See https://github.com/Pylons/webob/pull/460 | ||
|
||
Experimental Features | ||
~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,85 +23,71 @@ a certain type: | |
The classes that may be returned by one of the functions above, and their | ||
methods: | ||
|
||
.. autoclass:: Accept | ||
:members: parse | ||
|
||
.. autoclass:: AcceptOffer | ||
:members: __str__ | ||
|
||
.. autoclass:: AcceptValidHeader | ||
:members: parse, header_value, parsed, __init__, __add__, __bool__, | ||
__contains__, __iter__, __radd__, __repr__, __str__, | ||
accept_html, accepts_html, acceptable_offers, best_match, quality | ||
|
||
.. autoclass:: AcceptNoHeader | ||
:members: parse, header_value, parsed, __init__, __add__, __bool__, | ||
__contains__, __iter__, __radd__, __repr__, __str__, | ||
accept_html, accepts_html, acceptable_offers, best_match, quality | ||
.. autoenum:: HeaderState | ||
Comment on lines
23
to
+29
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "and their methods" makes the sentence quite ambiguous, and as the documentation for the classes also includes their non-method attributes, perhaps "and their methods" could be removed? (Assuming I'm reading the intended meaning correctly.) Under this, |
||
|
||
.. autoclass:: AcceptInvalidHeader | ||
:members: parse, header_value, parsed, __init__, __add__, __bool__, | ||
__contains__, __iter__, __radd__, __repr__, __str__, | ||
accept_html, accepts_html, acceptable_offers, best_match, quality | ||
.. autoclass:: Accept | ||
:members: | ||
parse, header_value, parsed, header_state, __init__, __add__, | ||
__bool__, __radd__, __repr__, __str__, __contains__, | ||
accept_html, accepts_html, acceptable_offers, best_match, quality | ||
|
||
.. autoclass:: AcceptCharset | ||
:members: parse | ||
|
||
.. autoclass:: AcceptCharsetValidHeader | ||
:members: parse, header_value, parsed, __init__, __add__, __bool__, | ||
__contains__, __iter__, __radd__, __repr__, __str__, | ||
__contains__, __iter__, __radd__, __repr__, __str__, | ||
acceptable_offers, best_match, quality | ||
|
||
.. autoclass:: AcceptCharsetNoHeader | ||
:members: parse, header_value, parsed, __init__, __add__, __bool__, | ||
__contains__, __iter__, __radd__, __repr__, __str__, | ||
__contains__, __iter__, __radd__, __repr__, __str__, | ||
acceptable_offers, best_match, quality | ||
|
||
.. autoclass:: AcceptCharsetInvalidHeader | ||
:members: parse, header_value, parsed, __init__, __add__, __bool__, | ||
__contains__, __iter__, __radd__, __repr__, __str__, | ||
__contains__, __iter__, __radd__, __repr__, __str__, | ||
acceptable_offers, best_match, quality | ||
|
||
.. autoclass:: AcceptEncoding | ||
:members: parse | ||
|
||
.. autoclass:: AcceptEncodingValidHeader | ||
:members: parse, header_value, parsed, __init__, __add__, __bool__, | ||
__contains__, __iter__, __radd__, __repr__, __str__, | ||
__contains__, __iter__, __radd__, __repr__, __str__, | ||
acceptable_offers, best_match, quality | ||
|
||
.. autoclass:: AcceptEncodingNoHeader | ||
:members: parse, header_value, parsed, __init__, __add__, __bool__, | ||
__contains__, __iter__, __radd__, __repr__, __str__, | ||
__contains__, __iter__, __radd__, __repr__, __str__, | ||
acceptable_offers, best_match, quality | ||
|
||
.. autoclass:: AcceptEncodingInvalidHeader | ||
:members: parse, header_value, parsed, __init__, __add__, __bool__, | ||
__contains__, __iter__, __radd__, __repr__, __str__, | ||
__contains__, __iter__, __radd__, __repr__, __str__, | ||
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, | ||
__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, | ||
__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, | ||
__radd__, __str__, parse, basic_filtering, best_match, lookup, | ||
quality | ||
|
||
Deprecated: | ||
|
||
.. autoclass:: MIMEAccept | ||
|
||
|
||
Cache-Control | ||
~~~~~~~~~~~~~ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would "webob.acceptparse.Accept's methods...", without the comma, be clearer?