Skip to content

Commit ad5275c

Browse files
committed
split the NEWS entry into two, and simplify _guess_media_encoding
1 parent 9a0d009 commit ad5275c

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

Lib/xml/dom/xmlbuilder.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -247,10 +247,11 @@ def _create_opener(self):
247247

248248
def _guess_media_encoding(self, source):
249249
info = source.byteStream.info()
250-
if "Content-Type" in info:
251-
for param in info.get_params([]):
252-
if param[0] == 'charset':
253-
return param[1].lower()
250+
# import email.message
251+
# 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()
254255

255256

256257
class DOMInputSource(object):
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
Allow :meth:`!xml.dom.xmlbuilder.DOMParser.parse` to correctly handle
22
:class:`!xml.dom.xmlbuilder.DOMInputSource` instances that only have a
3-
:attr:`!systemId` attribute set. Also, fix the broken
4-
:meth:`!xml.dom.xmlbuilder.DOMEntityResolver.resolveEntity` method.
3+
:attr:`!systemId` attribute set.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix :meth:`!xml.dom.xmlbuilder.DOMEntityResolver.resolveEntity`, which was
2+
broken by the Python 3.0 transition.

0 commit comments

Comments
 (0)