Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
15e848b0
Kaydet (Commit)
15e848b0
authored
May 19, 2012
tarafından
Senthil Kumaran
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Issue9374 - Generic parsing of query and fragment portion of urls for any scheme
üst
43ae3cea
1be320eb
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
9 deletions
+14
-9
test_urlparse.py
Lib/test/test_urlparse.py
+9
-0
parse.py
Lib/urllib/parse.py
+2
-9
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/test/test_urlparse.py
Dosyayı görüntüle @
15e848b0
...
...
@@ -636,11 +636,20 @@ class UrlParseTestCase(unittest.TestCase):
(
's3'
,
'foo.com'
,
'/stuff'
,
''
,
''
,
''
))
self
.
assertEqual
(
urllib
.
parse
.
urlparse
(
"x-newscheme://foo.com/stuff"
),
(
'x-newscheme'
,
'foo.com'
,
'/stuff'
,
''
,
''
,
''
))
self
.
assertEqual
(
urllib
.
parse
.
urlparse
(
"x-newscheme://foo.com/stuff?query#fragment"
),
(
'x-newscheme'
,
'foo.com'
,
'/stuff'
,
''
,
'query'
,
'fragment'
))
self
.
assertEqual
(
urllib
.
parse
.
urlparse
(
"x-newscheme://foo.com/stuff?query"
),
(
'x-newscheme'
,
'foo.com'
,
'/stuff'
,
''
,
'query'
,
''
))
# And for bytes...
self
.
assertEqual
(
urllib
.
parse
.
urlparse
(
b
"s3://foo.com/stuff"
),
(
b
's3'
,
b
'foo.com'
,
b
'/stuff'
,
b
''
,
b
''
,
b
''
))
self
.
assertEqual
(
urllib
.
parse
.
urlparse
(
b
"x-newscheme://foo.com/stuff"
),
(
b
'x-newscheme'
,
b
'foo.com'
,
b
'/stuff'
,
b
''
,
b
''
,
b
''
))
self
.
assertEqual
(
urllib
.
parse
.
urlparse
(
b
"x-newscheme://foo.com/stuff?query#fragment"
),
(
b
'x-newscheme'
,
b
'foo.com'
,
b
'/stuff'
,
b
''
,
b
'query'
,
b
'fragment'
))
self
.
assertEqual
(
urllib
.
parse
.
urlparse
(
b
"x-newscheme://foo.com/stuff?query"
),
(
b
'x-newscheme'
,
b
'foo.com'
,
b
'/stuff'
,
b
''
,
b
'query'
,
b
''
))
def
test_mixed_types_rejected
(
self
):
# Several functions that process either strings or ASCII encoded bytes
...
...
Lib/urllib/parse.py
Dosyayı görüntüle @
15e848b0
...
...
@@ -44,16 +44,9 @@ uses_netloc = ['ftp', 'http', 'gopher', 'nntp', 'telnet',
'imap'
,
'wais'
,
'file'
,
'mms'
,
'https'
,
'shttp'
,
'snews'
,
'prospero'
,
'rtsp'
,
'rtspu'
,
'rsync'
,
''
,
'svn'
,
'svn+ssh'
,
'sftp'
,
'nfs'
,
'git'
,
'git+ssh'
]
non_hierarchical
=
[
'gopher'
,
'hdl'
,
'mailto'
,
'news'
,
'telnet'
,
'wais'
,
'imap'
,
'snews'
,
'sip'
,
'sips'
]
uses_params
=
[
'ftp'
,
'hdl'
,
'prospero'
,
'http'
,
'imap'
,
'https'
,
'shttp'
,
'rtsp'
,
'rtspu'
,
'sip'
,
'sips'
,
'mms'
,
''
,
'sftp'
]
uses_query
=
[
'http'
,
'wais'
,
'imap'
,
'https'
,
'shttp'
,
'mms'
,
'gopher'
,
'rtsp'
,
'rtspu'
,
'sip'
,
'sips'
,
''
]
uses_fragment
=
[
'ftp'
,
'hdl'
,
'http'
,
'gopher'
,
'news'
,
'nntp'
,
'wais'
,
'https'
,
'shttp'
,
'snews'
,
'file'
,
'prospero'
,
''
]
# Characters valid in scheme names
scheme_chars
=
(
'abcdefghijklmnopqrstuvwxyz'
...
...
@@ -357,9 +350,9 @@ def urlsplit(url, scheme='', allow_fragments=True):
if
((
'['
in
netloc
and
']'
not
in
netloc
)
or
(
']'
in
netloc
and
'['
not
in
netloc
)):
raise
ValueError
(
"Invalid IPv6 URL"
)
if
allow_fragments
and
scheme
in
uses_fragment
and
'#'
in
url
:
if
allow_fragments
and
'#'
in
url
:
url
,
fragment
=
url
.
split
(
'#'
,
1
)
if
scheme
in
uses_query
and
'?'
in
url
:
if
'?'
in
url
:
url
,
query
=
url
.
split
(
'?'
,
1
)
v
=
SplitResult
(
scheme
,
netloc
,
url
,
query
,
fragment
)
_parse_cache
[
key
]
=
v
...
...
Misc/NEWS
Dosyayı görüntüle @
15e848b0
...
...
@@ -38,6 +38,9 @@ Core and Builtins
Library
-------
- Issue #9374: Generic parsing of query and fragment portions of url for any
scheme. Supported both by RFC3986 and RFC2396.
- Issue #14798: Fix the functions in pyclbr to raise an ImportError
when the first part of a dotted name is not a package. Patch by
Xavier de Gaye.
...
...
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