[issue4969] mimetypes on Windows should read MIME database from registry (w/patch)
Frank Hamand added the comment: From msg172531 in issue10551: You see, MIME\Database\Content Type in the Windows registry is a mime type - file extension mapping, *not the other way around*. But read_windows_registry() tries to use it as a file extension - mime type mapping, and bad things happen, because there are multiple mime types for certain file extensions. This enhancement has basically broken the mimetypes module on windows, e.g. On my system (windows 7 64 bit, python 3.3) mimetypes.guess_type('foo.png') ('image/x-png', None) mimetypes.guess_type('foo.jpg') ('image/pjpeg', None) The expected results are image/png and image/jpeg I'm having to work around this by calling mimetypes.init(files=[]) immediately after importing mimetypes to prevent it reading from the registry -- nosy: +shawabawa versions: +Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4969 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4969] mimetypes on Windows should read MIME database from registry (w/patch)
Changes by Gabriel Genellina gagsl-...@yahoo.com.ar: Removed file: http://bugs.python.org/file12774/mimetypes.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4969 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4969] mimetypes on Windows should read MIME database from registry (w/patch)
Gabriel Genellina gagsl-...@yahoo.com.ar added the comment: A new patch taking into account M. Pitrou comments: - name changed to read_windows_registry() - read_windows_registry() does nothing on non-Windows platforms; same as read_mime_types(filename) when the file does not exist. - I hope the coding style is acceptable now - the test is skipped on non-Windows platforms - documentation updated - documentation for MimeTypes.guess_all_extensions was missing; I added it although it isn't directly related to this issue. -- Added file: http://bugs.python.org/file15338/mimetypes.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4969 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4969] mimetypes on Windows should read MIME database from registry (w/patch)
Antoine Pitrou pit...@free.fr added the comment: Thank you, the patch looks ok to me. -- resolution: - accepted ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4969 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4969] mimetypes on Windows should read MIME database from registry (w/patch)
Antoine Pitrou pit...@free.fr added the comment: Committed in r76306 and r76307, closing. -- resolution: accepted - fixed stage: patch review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4969 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4969] mimetypes on Windows should read MIME database from registry (w/patch)
Antoine Pitrou pit...@free.fr added the comment: A couple of points: - if the method is Windows-specific, I don't think it shouldn't bear a name as generic as read_registry(). There are registries on other systems. - the method should probably raise early on non-Windows systems (raise NotImplementedError?) - please fix the coding style; don't collapse a try, except or finally and the following statement on a single line - in the tests, rather than defining an empty test case on non-Windows systems, make the tests skip (for example, call self.skipTest() -- nosy: +pitrou priority: - normal stage: - patch review type: - feature request versions: +Python 3.2 -Python 3.1 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4969 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4969] mimetypes on Windows should read MIME database from registry (w/patch)
Changes by Antoine Pitrou pit...@free.fr: -- nosy: +ocean-city ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4969 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4969] mimetypes on Windows should read MIME database from registry (w/patch)
Changes by Timothy Farrell tfarr...@swgen.com: -- nosy: +tercero12 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4969 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4969] mimetypes on Windows should read MIME database from registry (w/patch)
New submission from Gabriel Genellina gagsl-...@yahoo.com.ar: The mimetypes module has a built-in default database, and, in addition, reads mime.types files from a list of standard places (/etc/mime.types by example) On Windows, those files usually don't even present; MIME information is stored in the registry instead. Until now, the mimetypes module just ignored those settings; this patch adds support for reading the MIME database from the Windows registry. -- components: Library (Lib) files: mimetypes.diff keywords: patch messages: 80007 nosy: gagenellina severity: normal status: open title: mimetypes on Windows should read MIME database from registry (w/patch) versions: Python 2.6, Python 2.7, Python 3.0, Python 3.1 Added file: http://bugs.python.org/file12774/mimetypes.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4969 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4969] mimetypes on Windows should read MIME database from registry (w/patch)
Changes by Martin v. Löwis mar...@v.loewis.de: -- versions: -Python 2.6, Python 3.0 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4969 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com