GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — bpo-12707: deprecate info(), geturl(), getcode() methods in favor of headers, url, and status properties for HTTPResponse and addinfourl by epicfaace · Pull Request #11447 · python/cpython Conversation
|
|
Hello, and thanks for your contribution! I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA). Our records indicate we have not received your CLA. For legal reasons we need you to sign this before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue. If you have recently signed the CLA, please wait at least one business day You can check yourself to see if the CLA has been received. Thanks again for your contribution, we look forward to reviewing it! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I think there is no consensus on the issue about raising code level deprecation as noted in https://bugs.python.org/issue12707#msg234945 and this causes a lot of tests to fail to |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@tirkarthi Makes sense, I've removed the deprecation code/notice for now. It feels odd though having multiple methods/properties that return the same thing; ideally all the duplicates should be deprecated. For now I've added the "recommended to use [x] instead" notice in the docs. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Co-Authored-By: epicfaace <[email protected]>
|
|
||
| def test_getcode(self): | ||
| self.assertIsNone(self.returned_obj.getcode()) | ||
| self.assertIsNone(self.returned_obj.status) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I think it could be cleaner to separate these tests (recommended attributes first, then the older ones)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Ok.
In other tests that use the info(), geturl() functions, etc., do you suggest I update them to use the recommended attributes as well too?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
How many changes is that?
If the functions are doc-deprecated but will never actually raise warnings, maybe it’s not worth changing tens and tens of lines.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
|
||
| .. attribute:: addinfourl.status | ||
|
|
||
| Status code returned by server. Recommended to use :attr:`~addinfourl.status` instead. |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
~addinfourl.status links back to itself while building the docs locally. Also below methods geturl, info also link to addinfourl.status but it's documented to return only status code. Am I missing something here?status seems to be a newly added property. Does this need a versionadded directive?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Ha this is recursive! Was probably copied from the getstatus docs.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Oops, that was a typo. Added a versionadded directive.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
| .. method:: HTTPResponse.geturl() | ||
|
|
||
| Returns the URL of the resource retrieved. Recommended to use :attr:`~HTTPResponse.url` instead. |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Maybe this could be condensed to:
Deprecated method equivalent to :attr:`HTTPResponse.url`
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Is that okay to call it "deprecated" even when it doesn't return any DeprecationWarnings when used?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Yes, we name that «doc-deprecated», it’s a useful degree of deprecation.
(i.e. don’t break code that is fine, don’t annoy with warnings, just recommend the obvious way to do it in docs for people who want that)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Okay, I've went ahead and called it "deprecated" in the documentation. How do you keep track of which things mentioned in the documentation are deprecated and which are doc-deprecated?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
|
||
| .. attribute:: addinfourl.headers | ||
|
|
||
| Returns the meta-information of the page, such as headers, |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
What does «such as» mean? Is there something else than HTTP response headers in the headers property?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Again, this was moved from the original documentation, but will reword.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| .. attribute:: addinfourl.headers | ||
|
|
||
| Returns the meta-information of the page, such as headers, | ||
| in the form of an :func:`email.message_from_string` instance (see |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
See my previous comment: this should link to the EmailMessage class, not a factory function.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
| Returns the meta-information of the page, such as headers, | ||
| in the form of an :func:`email.message_from_string` instance (see | ||
| `Quick Reference to HTTP Headers <http://jkorpela.fi/http.html>`_) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Why link to a specific personal website here? I think people know what HTTP headers are, or if they don’t other parts of the docs probably already link to general-purpose documentation (W3C or Wikipedia).
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Uh, I just moved over the previous documentation that was already there. Now that you mention it, it's probably better to remove it.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Ah! In that case, keeping it is also OK. You can’t fix all the docs in one PR :)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
| .. attribute:: addinfourl.status | ||
|
|
||
| Status code returned by server. Recommended to use :attr:`~addinfourl.status` instead. |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
| Status code returned by server. Recommended to use :attr:`~addinfourl.status` instead. | |
| Same as *code*. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
| .. method:: addinfourl.geturl() | ||
|
|
||
| Returns the URL of the resource retrieved. Recommended to use :attr:`~addinfourl.status` instead. |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
What do you think of:
| Returns the URL of the resource retrieved. Recommended to use :attr:`~addinfourl.status` instead. | |
| Deprecated method equivalent to :attr:`~addinfourl.url`. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
| .. method:: addinfourl.info() | ||
|
|
||
| Returns the response headers. Recommended to use :attr:`~addinfourl.status` instead. |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
headers not status!
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
| .. method:: addinfourl.getstatus() | ||
|
|
||
| Returns the status. Recommended to use :attr:`~addinfourl.status` instead. |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Should status or code be the obvious recommended attribute?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Since originally both HTTPResponse and getaddrurl had the same three functions, info(), geturl(), and getcode(), and now we're replacing them with attributes instead. Both classes have .headers and .url so we're good with those two. However, there is no uniform attribute for the status code; we have HTTPResponse.status and addinfourl.code.
Since it seems like HTTPResponse.status is already documented, I thought it would be better just to rename addinfourl.code to addinfourl.status for consistency's sake.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Agreed that following HTTPResponse is best.
Suggested doc for status property: Returns the status code.
Doc for code: Same as status
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Sorry I am confused: does addinfourl.code already exist in a released version? If yes, I think we should keep it, recommend status, and not add code to HTTPResponse. If no, let’s keep only getcode (old) and status (recommended, same name as other class). Sounds good?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Oops, I made a typo. What I meant to say is that: HTTPResponse.status and addinfourl.code already both exist in a released version.
So my solution was to add a property called addinfourl.status which would be recommended to use over addinfourl.code.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution but could you update your PR with my remarks.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
|
||
| .. method:: HTTPResponse.geturl() | ||
|
|
||
| Deprecated method equivalent to :attr:`HTTPResponse.url`. |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Could you use
.. deprecated:: 3.9
The method :method:`HTTPResponse.geturl` is deprecated in favor of :attr:`HTTPResponse.url`
Check for the other attributes and the right syntax.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I disagree! Why generate a link to the section that we’re already in?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Ok, I've done something in between by starting the sentence just with "Deprecated in favor" while still keeping the deprecated:: markup.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase And if you don't make the requested changes, you will be put in the comfy chair! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I have made the requested changes; please review again |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thanks for making the requested changes! @merwok, @matrixise: please review the changes made to this pull request. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@epicfaace I have fixed the |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
I have seen an error with the deprecated directive and I can't compile the doc on my laptop
|
Thank you so much for your contribution, I closed the issue and have merged this PR. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
This PR documented functions returning a status code as Please could someone review PR #101296 to fix it? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.