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

[backport] feature: allow link argument to be set to None/empty in HTTP 451 exception #7704

Merged
merged 3 commits into from
Oct 15, 2023
Merged

[backport] feature: allow link argument to be set to None/empty in HTTP 451 exception #7704

merged 3 commits into from
Oct 15, 2023

Conversation

hhromic
Copy link
Contributor

@hhromic hhromic commented Oct 15, 2023

This PR is the backport of #7689 for 3.9.
I tried to backport it as close as possible to the state of the 3.9 branch.

…ption (#7689)

<!-- Thank you for your contribution! -->

This PR allows for the link argument to be set to None/empty (so it can
be optional) as per RFC in the HTTP 451 exception
(`HTTPUnavailableForLegalReasons`). It also adds suitable unit tests for
the `link` argument and aligns variable naming in the test class of this
exception.

I also updated the documentation for this exception and adjusted the
documented signatures of the other exceptions in the same section (the
`body` argument does not exist anymore).

The exception constructor no longer requires the `link` argument nor
accepts empty or invalid values.

- [X] I think the code is well written
- [X] Unit tests for the changes exist
- [X] Documentation reflects the changes
- [X] If you provide code modification, please add yourself to
`CONTRIBUTORS.txt`
  * The format is &lt;Name&gt; &lt;Surname&gt;.
  * Please keep alphabetical order, the file is sorted by names.
- [x] Add a new news fragment into the `CHANGES` folder
  * name it `<issue_id>.<type>` for example (588.bugfix)
* if you don't have an `issue_id` change it to the pr id after creating
the pr
  * ensure type is one of the following:
    * `.feature`: Signifying a new feature.
    * `.bugfix`: Signifying a bug fix.
    * `.doc`: Signifying a documentation improvement.
    * `.removal`: Signifying a deprecation or removal of public API.
* `.misc`: A ticket has been closed, but it is not of interest to users.
* Make sure to use full sentences with correct case and punctuation, for
example: "Fix issue with non-ascii contents in doctest text files."

---------

Co-authored-by: Sam Bull <aa6bs0@sambull.org>
(cherry picked from commit d7802fe)
@psf-chronographer psf-chronographer bot added the bot:chronographer:provided There is a change note present in this PR label Oct 15, 2023
@hhromic hhromic changed the title feature: allow link argument to be set to None/empty in HTTP 451 exce… [backport] feature: allow link argument to be set to None/empty in HTTP 451 exception Oct 15, 2023
@codecov
Copy link

codecov bot commented Oct 15, 2023

Codecov Report

Merging #7704 (a00b2ec) into 3.9 (6104dde) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##              3.9    #7704   +/-   ##
=======================================
  Coverage   97.30%   97.31%           
=======================================
  Files         107      107           
  Lines       31857    31881   +24     
  Branches     3719     3722    +3     
=======================================
+ Hits        31000    31024   +24     
  Misses        653      653           
  Partials      204      204           
Flag Coverage Δ
CI-GHA 97.22% <100.00%> (+<0.01%) ⬆️
OS-Linux 96.91% <100.00%> (+<0.01%) ⬆️
OS-Windows 94.42% <100.00%> (+<0.01%) ⬆️
OS-macOS 96.56% <100.00%> (-0.01%) ⬇️
Py-3.10.11 94.34% <100.00%> (+<0.01%) ⬆️
Py-3.10.13 96.74% <100.00%> (-0.01%) ⬇️
Py-3.11.5 96.44% <100.00%> (+<0.01%) ⬆️
Py-3.8.10 94.31% <100.00%> (+<0.01%) ⬆️
Py-3.8.18 96.68% <100.00%> (+<0.01%) ⬆️
Py-3.9.13 94.31% <100.00%> (+<0.01%) ⬆️
Py-3.9.18 96.72% <100.00%> (+<0.01%) ⬆️
Py-pypy7.3.11 96.20% <100.00%> (+<0.01%) ⬆️
VM-macos 96.56% <100.00%> (-0.01%) ⬇️
VM-ubuntu 96.91% <100.00%> (+<0.01%) ⬆️
VM-windows 94.42% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
aiohttp/web_exceptions.py 100.00% <100.00%> (ø)
tests/test_web_exceptions.py 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@Dreamsorcerer Dreamsorcerer merged commit 46b9906 into aio-libs:3.9 Oct 15, 2023
24 of 29 checks passed
@hhromic hhromic deleted the patchback/backports/3.9/d7802fe2e48bd7b1f70c8d66786ad125305eaa24/pr-7689 branch October 15, 2023 20:57
xiangxli pushed a commit to xiangxli/aiohttp that referenced this pull request Dec 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot:chronographer:provided There is a change note present in this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants