Commit Graph

43 Commits

Author SHA1 Message Date
Sandro Tosi a75039ad88 #5301: add image/vnd.microsoft.icon (.ico) MIME type 2011-08-21 00:15:56 +02:00
Brian Curtin 4cc5403527 Merged revisions 85774 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r85774 | brian.curtin | 2010-10-21 09:11:48 -0500 (Thu, 21 Oct 2010) | 7 lines

  Fix #10162: Add try/except around _winreg.OpenKey for keys that are
  unreadable by all users, e.g., Flash, Silverlight, and Java keys were
  causing errors.

  We don't currently have a way to grant/deny permissions for a key
  via winreg so there are no tests for this.
........
2010-10-21 14:48:22 +00:00
Antoine Pitrou f7c24450be Merged revisions 85497 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r85497 | antoine.pitrou | 2010-10-14 23:15:17 +0200 (jeu., 14 oct. 2010) | 3 lines

  Explicitly close some files (from issue #10093)
........
2010-10-14 21:22:52 +00:00
Georg Brandl 84fedf7f06 No need to assign the results of expressions used only for side effects. 2010-02-06 22:59:15 +00:00
Antoine Pitrou d5b34d4597 Issue #4969: The mimetypes module now reads the MIME database from
the registry under Windows.  Patch by Gabriel Genellina.
2009-11-15 14:10:48 +00:00
Antoine Pitrou f2651e193c Issue #5853: calling a function of the mimetypes module from several threads
at once could hit the recursion limit if the mimetypes database hadn't been
initialized before.
2009-04-27 20:50:20 +00:00
Benjamin Peterson ad58b7c9da fix a silly problem of caching gone wrong #5401 2009-03-02 03:35:12 +00:00
Guido van Rossum dff51b2898 Patch 1353 by Jacob Winther.
Add mp4 mapping to mimetypes.py.
2007-10-29 20:52:45 +00:00
Georg Brandl 0c1f6fcaac Add bz2 to content encodings. 2007-05-13 08:04:07 +00:00
Georg Brandl 0540be96f3 Bug #1202018: add some common mime.types locations. 2006-06-14 08:42:11 +00:00
Tim Peters 7d6b8954bf Whitespace normalization. 2006-04-06 19:35:27 +00:00
Anthony Baxter 04b9403e5b Fix for failure of test_urllib2 breaking test_mimetypes (SF bug 1464978)
will backport.
2006-04-06 07:31:31 +00:00
Fred Drake 7ce75151a4 add two more extensions:
- .wsdl --> Web Service Definition Language
- .xpdl --> XML Process Definition Language
2005-03-15 15:52:08 +00:00
Walter Dörwald 893020b59b Remove self from the arguments for the function add_type().
Backport candidate.
2003-12-19 18:15:10 +00:00
Walter Dörwald f0dfc7ac5c Fix a bunch of typos in documentation, docstrings and comments.
(From SF patch #810751)
2003-10-20 14:01:56 +00:00
Barry Warsaw 9caa0d1642 guess_all_extensions(): Return the empty list instead of None when
there are no matching types.  Updated the docs and docstrings.  Added
some unit tests.
2003-06-09 22:27:41 +00:00
Guido van Rossum 5e1222be57 Add Shockwave Flash.
(backport candidate?)
2003-01-04 14:11:38 +00:00
Walter Dörwald 8fa8972d80 Remove a list comprehension, because a loop over the list
is done afterwards anyway, so what the list comp does
can be done in the loop.
2003-01-03 21:06:46 +00:00
Walter Dörwald 51cc72c6c0 Pass the strict argument from read() on to readfp(), so the
file content ends up in the correct dict.
2003-01-03 21:02:36 +00:00
Walter Dörwald bb51ed333b Fix read_mime_types() so that it returns a dict as documented.
This fixes a bug reported as http://www.python.org/sf/661630,
which was introduced in the patch http://www.python.org/sf/554192.
2003-01-03 19:33:17 +00:00
Walter Dörwald 5ccaf8f129 Apply diff3.txt (plus additional documentation)
from SF patch http://www.python.org/sf/554192

This adds two new functions to mimetypes:
guess_all_extensions() which returns a list of all known
extensions for a mime type, and add_type() which adds one
mapping between a mime type and an extension.
2002-09-06 16:15:58 +00:00
Raymond Hettinger 54f0222547 SF 563203. Replaced 'has_key()' with 'in'. 2002-06-01 14:18:47 +00:00
Fred Drake 698da02d3b Separate the script portion from the library portion; everything that
pertains to the script is now in the if __name__ == "__main__" block.
This is in response to a commenton python-dev from Neal Norwitz.
2001-12-05 15:58:29 +00:00
Barry Warsaw 107771a228 Applying proposed patch for bug #474583, optional support for
non-standard but common types.  Including Martin's suggestion to add
rejected non-standard types from patch #438790.  Specifically,

guess_type(), guess_extension(): Both the functions and the methods
grow an optional "strict" flag, defaulting to true, which determines
whether to recognize non-standard, but commonly found types or not.

Also, I sorted, reformatted, and culled duplicates from the big
types_map dictionary.  Note that there are a few non-equivalent
duplicates (e.g. .cdf and .xls) for which the first will just get
thrown away.  I didn't remove those though.

Finally, use of the module as a script as grown the -l and -e options
to toggle strictness and to do guess_extension(), respectively.

Doc and unittest updates too.
2001-10-25 21:49:18 +00:00
Martin v. Löwis a3689fe786 Patch #438790: Add additional mappings.
Also remove mappings that are not registered with IANA, and not extensions.
2001-09-07 16:49:12 +00:00
Ka-Ping Yee 6cb0d4c632 Add some fairly important file extensions: bmp css doc mid midi mp2 mp3 xls.
Entries taken from the standard Debian mime.types file.
2001-08-18 04:06:54 +00:00
Fred Drake c81a06998f Another egregious error that copied the encodings info over the suffix
info.  Caught by the tests that I'm writing now.
2001-08-16 18:14:38 +00:00
Fred Drake c019ecb7fe Bad bug: the MimeTypes.readfp() was supposed to take a file object as a
parameter, but did not.  This was found because it can create failures
elsewhere based on the presence of mime.types files in some common locations
the module searches by default.

(I will be writing a test for this module shortly!)
2001-08-16 15:54:28 +00:00
Fred Drake eeee4ec4f1 Refactor so that it is easier to work with alternate MIME types databases,
and programmatically extend the database in different ways.

This closes the SF bug (feature request) #439710.
2001-08-03 21:01:44 +00:00
Martin v. Löwis 2750bcc2d1 Add .pyo as an extension, fixes bug #416462. Also restore alphabetic order. 2001-06-05 05:17:00 +00:00
Eric S. Raymond 51cc3bcd1c String method conversion. Added a trivial main to test it with. 2001-02-09 09:44:47 +00:00
Skip Montanaro 03d9014992 added a few more __all__ lists
test___all__.py: fail silently in check_all if the module can't be imported
2001-01-25 15:29:22 +00:00
Fred Drake 13a2c279c5 Untabify to pass the -tt test. 2000-02-10 17:17:14 +00:00
Fred Drake c40c54782c Map .js to application/x-javascript. 1999-05-20 12:52:04 +00:00
Fred Drake cbd987040e Added .rdf and .xsl as application/xml types. (.rdf is for the
Resource Description Framework, a metadata encoding, and .xsl is for
the Extensible Stylesheet Language.)
1999-03-11 16:04:04 +00:00
Guido van Rossum 1c5fb1cd1b Make mimetypes.guess_type understand data URLs. (Sjoerd Mullender) 1998-10-12 15:12:28 +00:00
Fred Drake c9132066e7 knownfiles: Add the default installation dirs for Apache
versions <= 1.2, >= 1.3.
1998-05-21 13:15:45 +00:00
Fred Drake 4941341858 guess_extension(): Revise documentation string to be more clear. If not
inited, call init().
1998-05-19 15:15:59 +00:00
Fred Drake 5109ffd607 guess_extension(): New function. Performs a reverse mapping from MIME type
to filename extension.
1998-05-18 16:27:20 +00:00
Fred Drake 3130b7a2a9 Fixed typo in docstring: suffixes_map --> suffix_map. 1998-05-18 16:05:24 +00:00
Guido van Rossum 7beaad4e75 Add file extension .xml, mapping it to text/xml. 1998-05-18 14:25:08 +00:00
Guido van Rossum 45e2fbc2e7 Mass check-in after untabifying all files that need it. 1998-03-26 21:13:24 +00:00
Guido van Rossum ac8a9f3ee9 Handy utility to guess MIME type from extension. 1997-09-30 19:05:50 +00:00