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
12237b3a
Kaydet (Commit)
12237b3a
authored
Agu 22, 2004
tarafından
Martin v. Löwis
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Replace yield with sequence class. Fixes #1009803.
üst
d3b0babf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
8 deletions
+21
-8
xmlrpclib.py
Lib/xmlrpclib.py
+21
-8
No files found.
Lib/xmlrpclib.py
Dosyayı görüntüle @
12237b3a
...
@@ -892,15 +892,19 @@ class _MultiCallMethod:
...
@@ -892,15 +892,19 @@ class _MultiCallMethod:
def
__call__
(
self
,
*
args
):
def
__call__
(
self
,
*
args
):
self
.
__call_list
.
append
((
self
.
__name
,
args
))
self
.
__call_list
.
append
((
self
.
__name
,
args
))
def
MultiCallIterator
(
results
)
:
class
MultiCallIterator
:
"""Iterates over the results of a multicall. Exceptions are
"""Iterates over the results of a multicall. Exceptions are
thrown in response to xmlrpc faults."""
thrown in response to xmlrpc faults."""
for
i
in
results
:
def
__init__
(
self
,
results
):
if
type
(
i
)
==
type
({}):
self
.
results
=
results
raise
Fault
(
i
[
'faultCode'
],
i
[
'faultString'
])
elif
type
(
i
)
==
type
([]):
def
__getitem__
(
self
,
i
):
yield
i
[
0
]
item
=
self
.
results
[
i
]
if
type
(
item
)
==
type
({}):
raise
Fault
(
item
[
'faultCode'
],
item
[
'faultString'
])
elif
type
(
item
)
==
type
([]):
return
item
[
0
]
else
:
else
:
raise
ValueError
,
\
raise
ValueError
,
\
"unexpected type in multicall result"
"unexpected type in multicall result"
...
@@ -1412,11 +1416,20 @@ if __name__ == "__main__":
...
@@ -1412,11 +1416,20 @@ if __name__ == "__main__":
# simple test program (from the XML-RPC specification)
# simple test program (from the XML-RPC specification)
# server = ServerProxy("http://localhost:8000") # local server
# server = ServerProxy("http://localhost:8000") # local server
server
=
ServerProxy
(
"http://
betty.userland.com
"
)
server
=
ServerProxy
(
"http://
time.xmlrpc.com/RPC2
"
)
print
server
print
server
try
:
try
:
print
server
.
examples
.
getStateName
(
41
)
print
server
.
currentTime
.
getCurrentTime
()
except
Error
,
v
:
print
"ERROR"
,
v
multi
=
MultiCall
(
server
)
multi
.
currentTime
.
getCurrentTime
()
multi
.
currentTime
.
getCurrentTime
()
try
:
for
response
in
multi
():
print
response
except
Error
,
v
:
except
Error
,
v
:
print
"ERROR"
,
v
print
"ERROR"
,
v
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