Skip to content

bpo-38216, bpo-36274: Allow subclasses to separately override validation and encoding behavior #16448

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

Merged
merged 10 commits into from
Sep 28, 2019
Merged

bpo-38216, bpo-36274: Allow subclasses to separately override validation and encoding behavior #16448

merged 10 commits into from
Sep 28, 2019

Conversation

jaraco
Copy link
Member

@jaraco jaraco commented Sep 28, 2019

This PR builds on and supersedes #16321 as an alternative approach for consideration.

https://bugs.python.org/issue38216

Copy link
Member

@ned-deily ned-deily left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, and I also prefer this approach. Thanks!

@jaraco jaraco merged commit 7774d78 into python:master Sep 28, 2019
@jaraco jaraco deleted the feature/38216-putrequest-hooks-separate branch September 28, 2019 12:32
@miss-islington
Copy link
Contributor

Thanks @jaraco for the PR 🌮🎉.. I'm working now to backport this PR to: 3.6, 3.7, 3.8.
🐍🍒⛏🤖

@bedevere-bot
Copy link

GH-16460 is a backport of this pull request to the 3.8 branch.

@miss-islington
Copy link
Contributor

Sorry, @jaraco, I could not cleanly backport this to 3.7 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker 7774d7831e8809795c64ce27f7df52674581d298 3.7

@miss-islington
Copy link
Contributor

Sorry @jaraco, I had trouble checking out the 3.6 backport branch.
Please backport using cherry_picker on command line.
cherry_picker 7774d7831e8809795c64ce27f7df52674581d298 3.6

@bedevere-bot
Copy link

GH-16461 is a backport of this pull request to the 3.7 branch.

@bedevere-bot
Copy link

GH-16462 is a backport of this pull request to the 3.6 branch.

jaraco added a commit that referenced this pull request Sep 28, 2019
…alidation and encoding behavior (GH-16448) (GH-16461)

* bpo-38216: Allow bypassing input validation

* bpo-36274: Also allow the URL encoding to be overridden.

* bpo-38216, bpo-36274: Add tests demonstrating a hook for overriding validation, test demonstrating override encoding, and a test to capture expectation of the interface for the URL.

* Call with skip_host to avoid tripping on the host checking in the URL.

* Remove obsolete comment.

* Make _prepare_path_encoding its own attr.

This makes overriding just that simpler.

Also, don't use the := operator to make backporting easier.

* Add a news entry.

* _prepare_path_encoding -> _encode_prepared_path()

* Once again separate the path validation and request encoding, drastically simplifying the behavior. Drop the guarantee that all processing happens in _prepare_path..
(cherry picked from commit 7774d78)

Co-authored-by: Jason R. Coombs <[email protected]>
miss-islington added a commit that referenced this pull request Sep 28, 2019
…ion and encoding behavior (GH-16448)

* bpo-38216: Allow bypassing input validation

* bpo-36274: Also allow the URL encoding to be overridden.

* bpo-38216, bpo-36274: Add tests demonstrating a hook for overriding validation, test demonstrating override encoding, and a test to capture expectation of the interface for the URL.

* Call with skip_host to avoid tripping on the host checking in the URL.

* Remove obsolete comment.

* Make _prepare_path_encoding its own attr.

This makes overriding just that simpler.

Also, don't use the := operator to make backporting easier.

* Add a news entry.

* _prepare_path_encoding -> _encode_prepared_path()

* Once again separate the path validation and request encoding, drastically simplifying the behavior. Drop the guarantee that all processing happens in _prepare_path.
(cherry picked from commit 7774d78)

Co-authored-by: Jason R. Coombs <[email protected]>
ned-deily pushed a commit that referenced this pull request Sep 28, 2019
…alidation and encoding behavior (GH-16448) (GH-16462)

(cherry picked from commit 7774d78)

Co-authored-by: Jason R. Coombs <[email protected]>
@jaraco
Copy link
Member Author

jaraco commented Sep 29, 2019

GH-16475 is a backport of this pull request to the 3.5 branch.

@jaraco
Copy link
Member Author

jaraco commented Sep 29, 2019

GH-16476 is a backport of this pull request to the 2.7 branch.

larryhastings pushed a commit that referenced this pull request Oct 8, 2019
…alidation and encoding behavior (GH-16448) (#16475)

* [3.5] bpo-38216, bpo-36274: Allow subclasses to separately override validation and encoding behavior (GH-16448)
jacobneiltaylor pushed a commit to jacobneiltaylor/cpython that referenced this pull request Dec 5, 2019
…ion and encoding behavior (pythonGH-16448)

* bpo-38216: Allow bypassing input validation

* bpo-36274: Also allow the URL encoding to be overridden.

* bpo-38216, bpo-36274: Add tests demonstrating a hook for overriding validation, test demonstrating override encoding, and a test to capture expectation of the interface for the URL.

* Call with skip_host to avoid tripping on the host checking in the URL.

* Remove obsolete comment.

* Make _prepare_path_encoding its own attr.

This makes overriding just that simpler.

Also, don't use the := operator to make backporting easier.

* Add a news entry.

* _prepare_path_encoding -> _encode_prepared_path()

* Once again separate the path validation and request encoding, drastically simplifying the behavior. Drop the guarantee that all processing happens in _prepare_path.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants