Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
96f2053b
Commit
96f2053b
authored
Jun 29, 2012
by
Antoine Pitrou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backed out changeset ee51e3aef302 - it broke the test suite
parent
97ac4a29
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
9 deletions
+8
-9
Lib/urlparse.py
Lib/urlparse.py
+8
-9
No files found.
Lib/urlparse.py
View file @
96f2053b
...
...
@@ -127,8 +127,8 @@ def urlparse(url, scheme='', allow_fragments=True):
Return a 6-tuple: (scheme, netloc, path, params, query, fragment).
Note that we don't break the components up in smaller bits
(e.g. netloc is a single string) and we don't expand % escapes."""
splitresult
=
urlsplit
(
url
,
scheme
,
allow_fragments
)
scheme
,
netloc
,
url
,
query
,
fragment
=
splitresult
tuple
=
urlsplit
(
url
,
scheme
,
allow_fragments
)
scheme
,
netloc
,
url
,
query
,
fragment
=
tuple
if
scheme
in
uses_params
and
';'
in
url
:
url
,
params
=
_splitparams
(
url
)
else
:
...
...
@@ -225,8 +225,7 @@ def urlunsplit(data):
empty query; the RFC states that these are equivalent)."""
scheme
,
netloc
,
url
,
query
,
fragment
=
data
if
netloc
or
(
scheme
and
scheme
in
uses_netloc
and
url
[:
2
]
!=
'//'
):
if
url
and
url
[:
1
]
!=
'/'
:
url
=
'/'
+
url
if
url
and
url
[:
1
]
!=
'/'
:
url
=
'/'
+
url
url
=
'//'
+
(
netloc
or
''
)
+
url
if
scheme
:
url
=
scheme
+
':'
+
url
...
...
@@ -308,7 +307,7 @@ def urldefrag(url):
# update it also in urllib. This code duplication does not existin in Python3.
_hexdig
=
'0123456789ABCDEFabcdef'
_hextochr
=
dict
((
a
+
b
,
chr
(
int
(
a
+
b
,
16
)))
_hextochr
=
dict
((
a
+
b
,
chr
(
int
(
a
+
b
,
16
)))
for
a
in
_hexdig
for
b
in
_hexdig
)
def
unquote
(
s
):
...
...
@@ -345,13 +344,13 @@ def parse_qs(qs, keep_blank_values=0, strict_parsing=0):
If false (the default), errors are silently ignored.
If true, errors raise a ValueError exception.
"""
parsed_resul
t
=
{}
dic
t
=
{}
for
name
,
value
in
parse_qsl
(
qs
,
keep_blank_values
,
strict_parsing
):
if
name
in
dict
:
parsed_resul
t
[
name
].
append
(
value
)
dic
t
[
name
].
append
(
value
)
else
:
parsed_resul
t
[
name
]
=
[
value
]
return
parsed_resul
t
dic
t
[
name
]
=
[
value
]
return
dic
t
def
parse_qsl
(
qs
,
keep_blank_values
=
0
,
strict_parsing
=
0
):
"""Parse a query given as a string argument.
...
...
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