mirror of https://github.com/python/cpython
Fix for failure of test_urllib2 breaking test_mimetypes (SF bug 1464978)
will backport.
This commit is contained in:
parent
e94e3b440f
commit
04b9403e5b
|
@ -315,6 +315,12 @@ def read_mime_types(file):
|
||||||
return db.types_map[True]
|
return db.types_map[True]
|
||||||
|
|
||||||
|
|
||||||
|
def _default_mime_types():
|
||||||
|
global suffix_map
|
||||||
|
global encodings_map
|
||||||
|
global types_map
|
||||||
|
global common_types
|
||||||
|
|
||||||
suffix_map = {
|
suffix_map = {
|
||||||
'.tgz': '.tar.gz',
|
'.tgz': '.tar.gz',
|
||||||
'.taz': '.tar.gz',
|
'.taz': '.tar.gz',
|
||||||
|
@ -326,8 +332,8 @@ encodings_map = {
|
||||||
'.Z': 'compress',
|
'.Z': 'compress',
|
||||||
}
|
}
|
||||||
|
|
||||||
# Before adding new types, make sure they are either registered with IANA, at
|
# Before adding new types, make sure they are either registered with IANA,
|
||||||
# http://www.isi.edu/in-notes/iana/assignments/media-types
|
# at http://www.isi.edu/in-notes/iana/assignments/media-types
|
||||||
# or extensions, i.e. using the x- prefix
|
# or extensions, i.e. using the x- prefix
|
||||||
|
|
||||||
# If you add to these, please keep them sorted!
|
# If you add to these, please keep them sorted!
|
||||||
|
@ -457,8 +463,8 @@ types_map = {
|
||||||
'.zip' : 'application/zip',
|
'.zip' : 'application/zip',
|
||||||
}
|
}
|
||||||
|
|
||||||
# These are non-standard types, commonly found in the wild. They will only
|
# These are non-standard types, commonly found in the wild. They will
|
||||||
# match if strict=0 flag is given to the API methods.
|
# only match if strict=0 flag is given to the API methods.
|
||||||
|
|
||||||
# Please sort these too
|
# Please sort these too
|
||||||
common_types = {
|
common_types = {
|
||||||
|
@ -473,6 +479,9 @@ common_types = {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
_default_mime_types()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
import sys
|
import sys
|
||||||
import getopt
|
import getopt
|
||||||
|
|
|
@ -8,6 +8,7 @@ from test import test_support
|
||||||
# Tell it we don't know about external files:
|
# Tell it we don't know about external files:
|
||||||
mimetypes.knownfiles = []
|
mimetypes.knownfiles = []
|
||||||
mimetypes.inited = False
|
mimetypes.inited = False
|
||||||
|
mimetypes._default_mime_types()
|
||||||
|
|
||||||
|
|
||||||
class MimeTypesTestCase(unittest.TestCase):
|
class MimeTypesTestCase(unittest.TestCase):
|
||||||
|
|
Loading…
Reference in New Issue