Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.buildout
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Xavier Thompson
slapos.buildout
Commits
9727dbb5
Commit
9727dbb5
authored
Jul 01, 2018
by
Jason Madden
Committed by
Xavier Thompson
Dec 05, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
The monkey patch for urllib.request._urlopener does nothing on Python 3.
(cherry picked from commit
f1589378
)
parent
7c525dac
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
18 deletions
+1
-18
src/zc/buildout/download.py
src/zc/buildout/download.py
+1
-18
No files found.
src/zc/buildout/download.py
View file @
9727dbb5
...
@@ -20,25 +20,8 @@ except ImportError:
...
@@ -20,25 +20,8 @@ except ImportError:
try
:
try
:
# Python 3
# Python 3
from
urllib.request
import
FancyURLopener
,
URLopener
,
urlretrieve
from
urllib.request
import
urlretrieve
from
urllib.parse
import
urlparse
from
urllib.parse
import
urlparse
from
urllib
import
request
import
warnings
class
PatchedURLopener
(
FancyURLopener
):
http_error_default
=
URLopener
.
http_error_default
def
__init__
(
self
,
*
args
,
**
kwargs
):
with
warnings
.
catch_warnings
():
warnings
.
simplefilter
(
'ignore'
)
# This creates a DeprecationWarning on 3.6:
# PatchedURLopener style of invoking requests is deprecated.
# Use newer urlopen functions/methods.
# Said warning breaks our doctests.
super
(
PatchedURLopener
,
self
).
__init__
(
*
args
,
**
kwargs
)
request
.
_urlopener
=
PatchedURLopener
()
# Ook! Monkey patch!
except
ImportError
:
except
ImportError
:
# Python 2
# Python 2
import
base64
import
base64
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment