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
e671fd20
Kaydet (Commit)
e671fd20
authored
Tem 22, 2009
tarafından
Alexandre Vassalotti
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #6360: Simplify string decoding in xmlrpc.client.
üst
fc477048
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
17 deletions
+4
-17
client.py
Lib/xmlrpc/client.py
+4
-17
No files found.
Lib/xmlrpc/client.py
Dosyayı görüntüle @
e671fd20
...
...
@@ -152,24 +152,11 @@ try:
except
ImportError
:
datetime
=
None
def
_decode
(
data
,
encoding
,
is8bit
=
re
.
compile
(
"[
\x80
-
\xff
]"
)
.
search
):
# decode non-ascii string (if possible)
if
encoding
and
is8bit
(
data
):
data
=
str
(
data
,
encoding
)
return
data
def
escape
(
s
):
s
=
s
.
replace
(
"&"
,
"&"
)
s
=
s
.
replace
(
"<"
,
"<"
)
return
s
.
replace
(
">"
,
">"
,)
def
_stringify
(
string
):
# convert to 7-bit ascii if possible
try
:
return
string
.
decode
(
"ascii"
)
except
(
UnicodeError
,
TypeError
,
AttributeError
):
return
string
__version__
=
"1.0.1"
# xmlrpc integer limits
...
...
@@ -755,8 +742,8 @@ class Unmarshaller:
def
end_string
(
self
,
data
):
if
self
.
_encoding
:
data
=
_decode
(
data
,
self
.
_encoding
)
self
.
append
(
_stringify
(
data
)
)
data
=
data
.
decode
(
self
.
_encoding
)
self
.
append
(
data
)
self
.
_value
=
0
dispatch
[
"string"
]
=
end_string
dispatch
[
"name"
]
=
end_string
# struct keys are always strings
...
...
@@ -774,7 +761,7 @@ class Unmarshaller:
dict
=
{}
items
=
self
.
_stack
[
mark
:]
for
i
in
range
(
0
,
len
(
items
),
2
):
dict
[
_stringify
(
items
[
i
])
]
=
items
[
i
+
1
]
dict
[
items
[
i
]
]
=
items
[
i
+
1
]
self
.
_stack
[
mark
:]
=
[
dict
]
self
.
_value
=
0
dispatch
[
"struct"
]
=
end_struct
...
...
@@ -811,7 +798,7 @@ class Unmarshaller:
def
end_methodName
(
self
,
data
):
if
self
.
_encoding
:
data
=
_decode
(
data
,
self
.
_encoding
)
data
=
data
.
decode
(
self
.
_encoding
)
self
.
_methodname
=
data
self
.
_type
=
"methodName"
# no params
dispatch
[
"methodName"
]
=
end_methodName
...
...
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