Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(3557)

Issue 104091: show Python mimetypes module some love

Can't Edit
Can't Publish+Mail
Start Review
Created:
15 years, 3 months ago by Jacob Rus
Modified:
8 years, 11 months ago
Reviewers:
Base URL:
http://svn.python.org/view/*checkout*/python/trunk/
Visibility:
Public.

Description

From the python tracker page: http://bugs.python.org/issue6626 "This version (#4) switches to expressing the default types as a list of tuples instead of as a dict, so that we can include duplicate rows so that "reverse" type -> extension lookups will behave properly, once we start changing the actual content of the defaults. The types_map and common_types dictionaries (aliases to the singleton MimeTypes object's types_map property) have been left behaving as before for backwards compatibility. The tests still pass."

Patch Set 1 #

Total comments: 9
Unified diffs Side-by-side diffs Delta from patch set Stats (+323 lines, -405 lines) Patch
Lib/mimetypes.py View 6 chunks +322 lines, -404 lines 9 comments Download
Lib/test/test_mimetypes.py View 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 3
Jacob Rus
15 years, 3 months ago (2009-08-12 04:51:39 UTC) #1
Jacob Rus
Add a bunch of comments. http://codereview.appspot.com/104091/diff/1/2 File Lib/mimetypes.py (left): http://codereview.appspot.com/104091/diff/1/2#oldcode222 Line 222: The way all ...
15 years, 3 months ago (2009-08-12 18:10:33 UTC) #2
Jacob Rus
15 years, 3 months ago (2009-08-12 18:15:25 UTC) #3
a couple more comments.

http://codereview.appspot.com/104091/diff/1/2
File Lib/mimetypes.py (right):

http://codereview.appspot.com/104091/diff/1/2#newcode57
Line 57: ]
I reordered these so that more recent Apache versions will come later, so that
we don't overwrite the more recent mappings with out-of-date ones.

Personally, I'd prefer to remove the dependency on Apache, and just ship a big
list of types inside the standard library, either inline in this module (as a
list of tuples) or as a separate file.

http://codereview.appspot.com/104091/diff/1/2#newcode88
Line 88: def add_types(self, type_pairs, strict=True):
I think I'd actually rather call this method 'register', and not include one in
the top level. If users want to add types, they should make their own MimeTypes
object and not muck with the singleton.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b