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
e9a78083
Kaydet (Commit)
e9a78083
authored
Şub 24, 2010
tarafından
Senthil Kumaran
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix for Issue7540 ; urllib2 will raise a TypeError when you try to add_data to
a existing req object already having data.
üst
60677a78
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
0 deletions
+4
-0
test_urllib2.py
Lib/test/test_urllib2.py
+1
-0
urllib2.py
Lib/urllib2.py
+3
-0
No files found.
Lib/test/test_urllib2.py
Dosyayı görüntüle @
e9a78083
...
@@ -1209,6 +1209,7 @@ class RequestTests(unittest.TestCase):
...
@@ -1209,6 +1209,7 @@ class RequestTests(unittest.TestCase):
self
.
get
.
add_data
(
"spam"
)
self
.
get
.
add_data
(
"spam"
)
self
.
assertTrue
(
self
.
get
.
has_data
())
self
.
assertTrue
(
self
.
get
.
has_data
())
self
.
assertEqual
(
"POST"
,
self
.
get
.
get_method
())
self
.
assertEqual
(
"POST"
,
self
.
get
.
get_method
())
self
.
assertRaises
(
TypeError
,
self
.
get
.
add_data
,
"more spam"
)
def
test_get_full_url
(
self
):
def
test_get_full_url
(
self
):
self
.
assertEqual
(
"http://www.python.org/~jeremy/"
,
self
.
assertEqual
(
"http://www.python.org/~jeremy/"
,
...
...
Lib/urllib2.py
Dosyayı görüntüle @
e9a78083
...
@@ -226,6 +226,9 @@ class Request:
...
@@ -226,6 +226,9 @@ class Request:
# XXX these helper methods are lame
# XXX these helper methods are lame
def
add_data
(
self
,
data
):
def
add_data
(
self
,
data
):
if
self
.
has_data
():
raise
TypeError
(
"Request Obj already contains data:
%
s"
%
self
.
data
)
self
.
data
=
data
self
.
data
=
data
def
has_data
(
self
):
def
has_data
(
self
):
...
...
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