Skip to content

Commit b0cfb6a

Browse files
use Message.get_param
Co-authored-by: Serhiy Storchaka <[email protected]>
1 parent ad5275c commit b0cfb6a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Lib/xml/dom/xmlbuilder.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,9 +249,10 @@ def _guess_media_encoding(self, source):
249249
info = source.byteStream.info()
250250
# import email.message
251251
# assert isinstance(info, email.message.Message)
252-
for ctp_name, ctp_value in info.get_params(()):
253-
if ctp_name == 'charset':
254-
return ctp_value.lower()
252+
charset = info.get_param('charset')
253+
if charset is not None:
254+
return charset.lower()
255+
return None
255256

256257

257258
class DOMInputSource(object):

0 commit comments

Comments
 (0)