classification
Title: add .svgz to mimetypes.suffix_map and .svg to types_map
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.2
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: terry.reedy Nosy List: eric.araujo, georg.brandl, gry, r.david.murray, terry.reedy
Priority: normal Keywords: patch

Created on 2010-12-18 13:13 by gry, last changed 2011-08-22 21:36 by eric.araujo. This issue is now closed.

Files
File name Uploaded Description Edit
mimetypes.svg.diff terry.reedy, 2010-12-23 00:21 Add .svg, .svgz
mimetypes.svg2.diff terry.reedy, 2010-12-23 18:56 Add .svg, .svgz
Messages (20)
msg124282 - (view) Author: Grygoriy Fuchedzhy (gry) Date: 2010-12-18 13:13
Please add '.svgz': '.svg.gz' map to mimetypes.suffix_map
msg124293 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2010-12-18 16:54
What are the media types, and are they registered with IANA?  A citation from http://www.isi.edu/in-notes/iana/assignments/media-types will be needed in order for this addition to happen if they are not x- types.

I checked out of curiousity, and the last time we added something to this table was .mp4, in 2007.
msg124297 - (view) Author: Grygoriy Fuchedzhy (gry) Date: 2010-12-18 17:11
I'm not sure we are talking about the same table. I don't see .mp4 there.
    suffix_map = {
        '.tgz': '.tar.gz',
        '.taz': '.tar.gz',
        '.tz': '.tar.gz',
        '.tbz2': '.tar.bz2',
        }
*.svgz is gzipped *.svg files.
msg124299 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2010-12-18 17:35
You are correct, I misread your message.  However, my point still stands.  .svg is not a file extension that appears in the types_map table, so adding the line you request to the suffix_map table is not something we would do by itself.  So, to correct my question, what is the media type for '.svg'?
msg124301 - (view) Author: Grygoriy Fuchedzhy (gry) Date: 2010-12-18 17:56
*.svg and *.svgz files have image/svg+xml media type.

I have following in /etc/mime.types
callisto ~ $ grep svg /etc/mime.types
image/svg+xml				svg svgz
msg124309 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2010-12-18 19:26
This media type does not appear in the official IANA registry.  Has it not yet been officially approved?  If you want to argue that its use is common enough and its approval immanent enough (I do see that it has been submitted) to warrant inclusion in Python prior to IANA approval, I think you will have to make this case to the python-dev mailing list.
msg124327 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2010-12-19 02:34
This issue is actually a request to add .svg to the types map and the the abbreviation .svgz for .svg.gx to the suffix_map.

I believe Scalable Vector Graphics are well on the way to becoming *the* standard vector graphics format for the web, especially with upcoming IE9 support. https://secure.wikimedia.org/wikipedia/en/wiki/Svg
It (they) are already supported by the other major browsers. In addition, "Google announced on 31 August 2010 that it had begun to index SVG content on the web, whether it is in standalone files or embedded in HTML."

So it might be sensible to add these now rather than two years from now. But if it is too late for 3.2, then I expect addition for 3.3 will be obvious.
msg124328 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2010-12-19 02:38
Separate issue: from the mimetypes doc ...
"MimeTypes.types_map 
Dictionary mapping filename extensions to MIME types. This is initially a copy of the global types_map defined in the module."

But on Windows, I get a *tuple*, not a dict, of two dicts. The first has just a few pairs
>>> mi.types_map[0]
{'.xul': 'text/xul', '.pic': 'image/pict', '.pict': 'image/pict', '.jpg': 'image/jpg', '.rtf': 'application/rtf', '.pct': 'image/pict', '.mid': 'audio/midi', '.midi': 'audio/midi'}
and the second about a hundred more. Is this a bug?
msg124332 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2010-12-19 06:45
I think a variance from the policy stated in mimetypes is quite possible, and the kind of information you provide, Terry, is a step in that direction.  We would need release manager approval, of course, since we are in Beta, but this is a small enough change I think it would fly, assuming the policy variance is approved.

For types_map, it's a doc bug.  It is indeed a tuple of dictionaries, the first being the limited, 'strict' set and the second normally including stuff from the "standard locations", which on windows includes the registry.

So, there is an argument in favor of adding the suffix map even if the types_map isn't updated for .svg, since the .svg mapping could come from one of the 'standard locations'.  I'd rather add both, though.
msg124401 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-12-20 19:30
+1 on adding SVG types in 3.2 or 3.3.
msg124524 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2010-12-23 00:21
Patch attached.

The instructions, after editing the url, are
    # Before adding new types, make sure they are either registered with IANA,
    # at http://www.iana.org/assignments/media-types
    # or extensions, i.e. using the x- prefix

Since there is no registration yet, I add the x- prefix. I presume that can be deleted without harm when it is registered. David, is that true?

Georg, is this OK for 3.2c1?
It can only break code depending on the entries not existing.
msg124539 - (view) Author: Grygoriy Fuchedzhy (gry) Date: 2010-12-23 08:46
Shouldn't .svgz be also added as 'image/x-svg+xml'?
msg124540 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2010-12-23 09:13
No, the other combined suffixes are not either.
msg124557 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-12-23 16:12
I believe the patch should add the used but non-standard image/svg+xml type to the common_type dictionary, not invent a new x- type.
msg124561 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2010-12-23 18:21
Yes, adding the x- version would probably be pointless as most likely nobody uses it.

Has anyone found any definitive info on where exactly in the approval process image/svg+xml is?

I think we should probably just go ahead and put it in, but it would be nice to link to some mailing list discussion somewhere that indicates that it is solidly standards track.

I found a mailing list posting from 2000 about browser support.

I found this: http://www.w3.org/TR/SVG/intro.html from June 2010 saying the registration was in progress at the w3c.  How w3c registration relates to IANA registration is not entirely clear, but most likely IANA wouldn't register it without w3c approving it first.

RFC 3023 mentions it and says it hasn't been approved yet so it shouldn't be used.  That was in 2001.

Why the incredibly long delay?

As best as I can guess, the mime-type registration is conditioned on the acceptance of the underlying SVG standard it references, and that standard (SVG 1.1) has not yet been ratified by the W3C, which is, if I'm underanding the RFCs correctly, required for IANA approval of the media type request.  SVG 1.1 has, according to wikipedia, been put out for Last Call.

All of which seems pretty irrelevant to the value and likely stability of the image/svg+xml name itself.  Since all the major browsers are supporting it, as far as I can tell, I think Python should too.
msg124564 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2010-12-23 18:56
I obviously misunderstood the instruction about 'x-' and will remove that. Should I leave the entry where it is or move as Éric suggested?
msg124565 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-12-23 19:00
I’m not sure; the common_types is actually for invalid but used types, like image/jpg (the correct one is image/jpeg and is listed in types_map).  The status of IANA registration is unclear (thanks David for looking at that); since common tools understand that media type, let’s pretend it’s registered.
msg124566 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2010-12-23 19:00
No, I don't think it qualifies as a common_type.

But since this is technically a feature request we need Georg's approval for the commit.
msg124569 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2010-12-23 21:14
Got approval from Georg on IRC, so go ahead and commit it, Terry.  Or assign it to me if you'd rather I do it.
msg124573 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2010-12-23 23:13
r87460
History
Date User Action Args
2011-08-22 21:36:56eric.araujosetresolution: accepted -> fixed
stage: commit review -> resolved
2010-12-23 23:13:43terry.reedysetstatus: open -> closed

messages: + msg124573
resolution: accepted
nosy: georg.brandl, terry.reedy, eric.araujo, r.david.murray, gry
2010-12-23 21:14:14r.david.murraysetnosy: georg.brandl, terry.reedy, eric.araujo, r.david.murray, gry
messages: + msg124569
2010-12-23 19:00:29r.david.murraysetnosy: georg.brandl, terry.reedy, eric.araujo, r.david.murray, gry
messages: + msg124566
2010-12-23 19:00:15eric.araujosetnosy: georg.brandl, terry.reedy, eric.araujo, r.david.murray, gry
messages: + msg124565
2010-12-23 18:56:33terry.reedysetfiles: + mimetypes.svg2.diff
nosy: georg.brandl, terry.reedy, eric.araujo, r.david.murray, gry
messages: + msg124564
2010-12-23 18:21:18r.david.murraysetnosy: georg.brandl, terry.reedy, eric.araujo, r.david.murray, gry
messages: + msg124561
2010-12-23 16:12:40eric.araujosetnosy: georg.brandl, terry.reedy, eric.araujo, r.david.murray, gry
messages: + msg124557
2010-12-23 09:13:56terry.reedysetnosy: georg.brandl, terry.reedy, eric.araujo, r.david.murray, gry
messages: + msg124540
2010-12-23 08:46:12grysetnosy: georg.brandl, terry.reedy, eric.araujo, r.david.murray, gry
messages: + msg124539
2010-12-23 00:22:11terry.reedysetnosy: georg.brandl, terry.reedy, eric.araujo, r.david.murray, gry
stage: commit review
2010-12-23 00:21:20terry.reedysetfiles: + mimetypes.svg.diff
nosy: georg.brandl, terry.reedy, eric.araujo, r.david.murray, gry
messages: + msg124524

assignee: terry.reedy
keywords: + patch
2010-12-20 19:30:23eric.araujosetnosy: + eric.araujo
messages: + msg124401
2010-12-19 06:45:08r.david.murraysetnosy: + georg.brandl

messages: + msg124332
title: add .svgz to mimetypes.suffix_map -> add .svgz to mimetypes.suffix_map and .svg to types_map
2010-12-19 02:38:35terry.reedysetmessages: + msg124328
2010-12-19 02:34:08terry.reedysetnosy: + terry.reedy
messages: + msg124327
2010-12-18 19:26:47r.david.murraysetnosy: r.david.murray, gry
messages: + msg124309
2010-12-18 17:56:43grysetnosy: r.david.murray, gry
messages: + msg124301
2010-12-18 17:35:51r.david.murraysetnosy: r.david.murray, gry
messages: + msg124299
2010-12-18 17:11:46grysetnosy: r.david.murray, gry
messages: + msg124297
2010-12-18 16:54:27r.david.murraysetnosy: + r.david.murray

messages: + msg124293
versions: + Python 3.2
2010-12-18 13:13:03grycreate