MIME type handling for Zope
Project description
==================
Mimetypes Registry
==================
Provide a registry of mimetypes, accessible via the ``mimetypes_registry``
tool.
Upgrade from older versions
===========================
If you want to use the updated mimetypes registry database from the version
after 2.0.6 and you don't have important customizations you need to keep, just
delete the old ``mimetypes_registry`` tool from ZMI and import all steps from
the ``MimetypesRegistry`` profile.
How to update the mimetypes registry from freedesktop.org
=========================================================
1) Clone the ``shared-mime-info`` repository from freedesktop.org::
$ git clone git://anongit.freedesktop.org/xdg/shared-mime-info
2) Build it::
$ cd shared-mime-info
$ ./autogen.sh
$ ./configure
$ make
3) Copy the ``freedesktop.org.xml`` file to Products.MimetypesRegistry's
``mime_type`` folder.
Authors
=======
Benjamin Saller <bcsaller@yahoo.com>
Sidnei da Silva <sidnei@x3ng.com>
Sylvain Thenault <sylvain.thenault@logilab.fr>
Christian Heimes <tiran@cheimes.de>
Credits
=======
Mimetypes registry information from freedesktop.org.
Icons from:
* Plone: http://plone.org
* Tango: http://tango.freedesktop.org
* FamFamFam: http://www.famfamfam.com
Changelog
=========
2.0.7 (2015-03-21)
------------------
- Update ``freedesktop.org.xml`` file from
http://cgit.freedesktop.org/xdg/shared-mime-info/
This should fix outdated mimetype recognition like ``.ogg`` being
``application/ogg`` rather than ``audio/ogg`` or ``docx`` being
``application/zip``.
[thet]
- Upgrade test infrastructure to plone.testing.
[tomgross]
2.0.6 (2014-09-07)
------------------
- Remove "Article" from magic matching.
Ref https://dev.plone.org/ticket/14078
[ebrehault]
2.0.5 (2013-08-13)
------------------
- Add missing module security declarations.
2.0.4 (2013-01-13)
------------------
- Nothing changed yet.
2.0.3 (2011-08-23)
------------------
- Allow exception MimetypeRegistry in python scripts.
Refs http://dev.plone.org/plone/ticket/12061.
[thomasdesvenain]
2.0.2 - 2011-05-12
------------------
- Optimize images and icon file sizes.
[hannosch]
- More significant icon for application/msword files.
From http://www.famfamfam.com/
Closes http://dev.plone.org/plone/ticket/11336.
[thomasdesvenain]
- Convert import step to be registered in ZCML partially fixing #8350
[kiorky]
2.0.1 - 2010-07-15
------------------
- Removed the invalid `text/python-source` mime type declaration and replaced
it with the valid but unofficial `text/x-python`.
[hannosch]
2.0 - 2010-07-01
----------------
- Updated icons to a more modern set from Tango and Plone.
[limi]
2.0b1 - 2009-12-27
------------------
- Use standard logging instead of relying on Archetypes helpers.
[hannosch]
- Removed BBB code for zope.contenttype.
[hannosch]
2.0a1 - 2009-11-13
------------------
- Avoid acquiring `mimetypes_registry` and call it via a proper API.
[hannosch]
- Avoid acquiring `portal_properties` and call it via a proper API.
[hannosch]
- Cleaned up package metadata and general code.
[hannosch]
- Declare package dependencies and fixed deprecation warnings for use
of Globals.
[hannosch]
- Purged old Zope 2 Interface interfaces for Zope 2.12 compatibility.
Consider branching before this revision if release required before Plone 4.
[elro]
1.6.4 - UNRELEASED
------------------
- Nothing
1.6.3 - 2009-05-16
------------------
- Fix bug due to removed version.txt in 1.6.2.
[wichert]
1.6.2 - 2009-05-16
------------------
- Updated freedesktop.org shared-mime-info from the
shared-mime-info-0.51.tar.bz2 file.
[sidnei]
- Added Office 2007 mime types to the mime.types file, which was
copied from Apache ages ago. The current version of Apache doesn't
contain those yet, nor does the shared-mime-info. Care must be taken
when this file is updated again to make sure those mime types are
not removed accidentally.
[sidnei]
1.6.1 - 2008-09-30
------------------
- Updated freedesktop.org shared-mime-info from the
shared-mime-info-0.23.tar.bz2 file.
[hannosch]
- Added metadata.xml file to the profile.
[hannosch]
- Changed fixUpSMIGlobs not to reinitialize the smi_mimetypes, when they are
already initialized during tool creation.
[hannosch]
- Compile the 750KiB freedesktop.org.xml file to a binary format which gets
loaded on Zope startup instead of reparsing the XML file each time. If the
modification time of the source xml file changes, the binary file is
automatically recreated. If the binary file cannot be created the xml file
is reparsed each time as before.
[hannosch]
- Change some mimetypes returnd by guessMime to match the mimetypes
registered in mtr (from freedesktop.org's mime database).
[csenger]
- Ensure that lookup doesn't return an empty tuple if asked with a
mimetypestring returned by guessMime.
Fixes http://dev.plone.org/plone/ticket/7876
[csenger]
- Lookup by extensions (not glob) as submitted and retry it with lower case to
catch filenames like 'file.TXT'
[csenger]
1.6.0 - 2007-08-16
------------------
- Nothing
1.6.0-rc2 - 2007-07-27
----------------------
- Updated componentregisty.xml to new style.
[hannosch]
1.6.0-rc1 - 2007-07-04
----------------------
- Do not modify the portal_skins tool configuration
[wichert]
1.6.0-b5 - 2007-05-05
---------------------
- Fix signature of fixUpSMIGlobs.
[wichert]
1.6.0-b4 - 2007-04-28
---------------------
- Go back to using getToolByName for CMF tools.
[nouri]
1.6.0-b3 - 2007-03-20
---------------------
- Removed tests/runalltests.py and tests/framework.py as they have
outlived their usefulness. To run tests use Zope's testrunner:
./bin/zopectl test --nowarn -s Products.MimetypesRegistry
[stefan]
1.6.0-b2 - 2007-03-05
---------------------
- Use new cmf:registerDirectory zcml directive and removed corresponding code
from the initialize method.
[hannosch]
1.6.0-b1 - 2007-02-27
---------------------
- version bumped to 1.6, 1.5 is now for archetypes 1.4 bugfixing
whatever happens with 1.6.x shouldt have effects on AT 1.4
[jensens]
1.5.0-a1 - 2007-02-06
---------------------
- Implemented PLIP 149
[tomster]
1.4.1-final - 2006-09-15
------------------------
- Converted usage of zLOG to new Python logging module.
[hannosch]
- Mime type links are now urllib quoted. This fixes #682
(http://dev.plone.org/archetypes/ticket/682).
[rocky]
1.4.0-final - 2006-06-16
------------------------
- Use zope.contenttype in favor of zope.app.content_types if available.
[hannosch]
1.4.0-beta2 - 2006-05-12
------------------------
- Use zope.app.content_types in favor of OFS.content_types if available.
[stefan]
- Spring-cleaning of tests infrastructure.
[hannosch]
1.4.0-beta1 - 2006-03-26
------------------------
- fixed Plone #5027: MimeTypeRegistry.classify doesn't handle
"no mimetype" gracefully. Returns 'None' now.
[jensens]
- fixed http://dev.plone.org/archetypes/ticket/622
[jensens]
1.4.0-alpha02 - 2006-02-23
--------------------------
- ensured that the key gotten back from windows_mimetypes.py existed
mark says the best way is to examine each key to ensure its valid but
would be slower.
[runyaga]
- removed odd archetypes 1.3 style version checking
[jensens]
- Removed BBB code for CMFCorePermissions import location.
[hannosch]
- removed deprecation warning for ToolInit.
[jensens]
- skip backward compatibility to the times where MTR where part of
PortalTransforms.
[jensens]
1.3.8-final02 - 2006-01-15
--------------------------
- nothing - the odd version checking needs a version change to stick to
Archetypes version again.
[yenzenz]
1.3.8-RC1 - 2005-12-29
----------------------
- Split yet another part of register() into a separate
method. Cleanup smi_mimetypes initialize a little bit to to use
the new method when adding new mimetypes to a already-registered
entry.
[dreamcatcher]
- Include aliases in the list of mimetypes for a entry. Based on
patch by Jean Jordaan
[dreamcatcher]
- Use a SAX-based parser instead of minidom to improve Zope startup
time (by 17 seconds on my Pismo) and memory footprint.
[dreamcatcher]
- Augment known mimetypes with Windows mimetypes, if available.
[dreamcatcher]
1.3.7-final01 - 2005-10-11
--------------------------
- For the sake of sanity, include a 'mime.types' with
MimetypesRegistry to minimize the platform-specific differences in
mime detection when the python 'mimetypes' module is involved.
[dreamcatcher]
- globs from freedesktop.org shared-mime-info were incorrectly
mapped to 'extensions' and never really worked because the code
tried to strip a leading dot, where the globs normally had ``*.``.
The side-effect of this is that in unix, the Python 'mimetypes'
module would happily read '/etc/mime.types' and gracefully work
(/etc/mime.types has most of the extensions of shared-mime-info
but a few), where on Windows it would fail to detect mimetypes by
extension.
[dreamcatcher]
- Added support for real globs, using fnmatch.translate and
re.compile and a migration function that will be run from Plone
2.1.1 migration, with some tests specific for globs read from
shared-mime-info.
[dreamcatcher]
1.3.6-final01 - 2005-08-30
--------------------------
- after one night sleeping over it I removed the yesterday added method.
therefore I added according to some heuristics and OOo-Documentation
some magic bytes to magic.py and made better tests.
[yenzenz]
- added a method to detect mimetypes of zipped files,
here specialy for OOo now all Openofice files and zip
files are detected properly. my simple tests are working:
a OOo-Writer and a simpe zipfile are detected.
[yenzenz]
- updated freedesktop.org.xml file to latest CVS version rev 1.57 from
http://cvs.freedesktop.org/mime/shared-mime-info/freedesktop.org.xml
[yenzenz]
1.3.5-final03 - 2005-08-07
--------------------------
- nothing - the odd version checking needs a version change to stick to
Archetypes version again.
[yenzenz]
1.3.5-final02 - 2005-08-01
--------------------------
- nothing again, need to stick to Archetypes version
[yenzenz]
1.3.5-final - 2005-07-17
------------------------
- Added Five/Zope3 interface bridges and implements
[tiran]
1.3.4-final - 2005-07-06
------------------------
- added icons for openoffice.org files
[yenzenz]
1.3.3-final06 - 2005-05-20
--------------------------
- nothing (I hate to write this. But the odd version checking needs it).
[yenzenz]
1.3.3-final-02 - 2005-03-25
---------------------------
- nothing
1.3.3-final - 2005-03-05
------------------------
- More a workaround than a fix for [ 1056252 ] Content type algorithm
can be confused.
[tiran]
- workaround for [ 1068001 ] BaseUnit Encoding Error: macintosh
[yenzenz]
- In the case all else fails, try to resort to guess_content_type so
that at least we don't get 'text/plain' when the file is in fact a
binary file.
[dreamcatcher]
1.3.2-5 - 2004-09-30
--------------------
- nothing
1.3.2-4 - 2004-09-30
--------------------
- nothing
1.3.2-3 - 2004-09-25
--------------------
- nothing
1.3.2-2 - 2004-09-17
--------------------
- nothing
1.3.2-1 - 2004-09-04
--------------------
- Cleaned up major parts of PT by removing the python only implementation which
was broken anyway
[tiran]
1.3.1-1 - 2004-08-16
--------------------
- Added text/x-html-safe mime type for new transformation
[tiran]
- Don't return acquisition wrapped mimetype items beause they may lead to
memory leaks.
[tiran]
1.3.0-3 - 2004-08-06
--------------------
- Added text/wiki mime type
[tiran]
- Don't log redefine warning if the currrent and the new object are equal
[tiran]
- initialize() MTR on __setstate__ aka when the MTR is loaded from ZODB.
[tiran]
1.3.0-2 - 2004-07-29
--------------------
- Changed version to stick to Archetypes version.
[tiran]
Mimetypes Registry
==================
Provide a registry of mimetypes, accessible via the ``mimetypes_registry``
tool.
Upgrade from older versions
===========================
If you want to use the updated mimetypes registry database from the version
after 2.0.6 and you don't have important customizations you need to keep, just
delete the old ``mimetypes_registry`` tool from ZMI and import all steps from
the ``MimetypesRegistry`` profile.
How to update the mimetypes registry from freedesktop.org
=========================================================
1) Clone the ``shared-mime-info`` repository from freedesktop.org::
$ git clone git://anongit.freedesktop.org/xdg/shared-mime-info
2) Build it::
$ cd shared-mime-info
$ ./autogen.sh
$ ./configure
$ make
3) Copy the ``freedesktop.org.xml`` file to Products.MimetypesRegistry's
``mime_type`` folder.
Authors
=======
Benjamin Saller <bcsaller@yahoo.com>
Sidnei da Silva <sidnei@x3ng.com>
Sylvain Thenault <sylvain.thenault@logilab.fr>
Christian Heimes <tiran@cheimes.de>
Credits
=======
Mimetypes registry information from freedesktop.org.
Icons from:
* Plone: http://plone.org
* Tango: http://tango.freedesktop.org
* FamFamFam: http://www.famfamfam.com
Changelog
=========
2.0.7 (2015-03-21)
------------------
- Update ``freedesktop.org.xml`` file from
http://cgit.freedesktop.org/xdg/shared-mime-info/
This should fix outdated mimetype recognition like ``.ogg`` being
``application/ogg`` rather than ``audio/ogg`` or ``docx`` being
``application/zip``.
[thet]
- Upgrade test infrastructure to plone.testing.
[tomgross]
2.0.6 (2014-09-07)
------------------
- Remove "Article" from magic matching.
Ref https://dev.plone.org/ticket/14078
[ebrehault]
2.0.5 (2013-08-13)
------------------
- Add missing module security declarations.
2.0.4 (2013-01-13)
------------------
- Nothing changed yet.
2.0.3 (2011-08-23)
------------------
- Allow exception MimetypeRegistry in python scripts.
Refs http://dev.plone.org/plone/ticket/12061.
[thomasdesvenain]
2.0.2 - 2011-05-12
------------------
- Optimize images and icon file sizes.
[hannosch]
- More significant icon for application/msword files.
From http://www.famfamfam.com/
Closes http://dev.plone.org/plone/ticket/11336.
[thomasdesvenain]
- Convert import step to be registered in ZCML partially fixing #8350
[kiorky]
2.0.1 - 2010-07-15
------------------
- Removed the invalid `text/python-source` mime type declaration and replaced
it with the valid but unofficial `text/x-python`.
[hannosch]
2.0 - 2010-07-01
----------------
- Updated icons to a more modern set from Tango and Plone.
[limi]
2.0b1 - 2009-12-27
------------------
- Use standard logging instead of relying on Archetypes helpers.
[hannosch]
- Removed BBB code for zope.contenttype.
[hannosch]
2.0a1 - 2009-11-13
------------------
- Avoid acquiring `mimetypes_registry` and call it via a proper API.
[hannosch]
- Avoid acquiring `portal_properties` and call it via a proper API.
[hannosch]
- Cleaned up package metadata and general code.
[hannosch]
- Declare package dependencies and fixed deprecation warnings for use
of Globals.
[hannosch]
- Purged old Zope 2 Interface interfaces for Zope 2.12 compatibility.
Consider branching before this revision if release required before Plone 4.
[elro]
1.6.4 - UNRELEASED
------------------
- Nothing
1.6.3 - 2009-05-16
------------------
- Fix bug due to removed version.txt in 1.6.2.
[wichert]
1.6.2 - 2009-05-16
------------------
- Updated freedesktop.org shared-mime-info from the
shared-mime-info-0.51.tar.bz2 file.
[sidnei]
- Added Office 2007 mime types to the mime.types file, which was
copied from Apache ages ago. The current version of Apache doesn't
contain those yet, nor does the shared-mime-info. Care must be taken
when this file is updated again to make sure those mime types are
not removed accidentally.
[sidnei]
1.6.1 - 2008-09-30
------------------
- Updated freedesktop.org shared-mime-info from the
shared-mime-info-0.23.tar.bz2 file.
[hannosch]
- Added metadata.xml file to the profile.
[hannosch]
- Changed fixUpSMIGlobs not to reinitialize the smi_mimetypes, when they are
already initialized during tool creation.
[hannosch]
- Compile the 750KiB freedesktop.org.xml file to a binary format which gets
loaded on Zope startup instead of reparsing the XML file each time. If the
modification time of the source xml file changes, the binary file is
automatically recreated. If the binary file cannot be created the xml file
is reparsed each time as before.
[hannosch]
- Change some mimetypes returnd by guessMime to match the mimetypes
registered in mtr (from freedesktop.org's mime database).
[csenger]
- Ensure that lookup doesn't return an empty tuple if asked with a
mimetypestring returned by guessMime.
Fixes http://dev.plone.org/plone/ticket/7876
[csenger]
- Lookup by extensions (not glob) as submitted and retry it with lower case to
catch filenames like 'file.TXT'
[csenger]
1.6.0 - 2007-08-16
------------------
- Nothing
1.6.0-rc2 - 2007-07-27
----------------------
- Updated componentregisty.xml to new style.
[hannosch]
1.6.0-rc1 - 2007-07-04
----------------------
- Do not modify the portal_skins tool configuration
[wichert]
1.6.0-b5 - 2007-05-05
---------------------
- Fix signature of fixUpSMIGlobs.
[wichert]
1.6.0-b4 - 2007-04-28
---------------------
- Go back to using getToolByName for CMF tools.
[nouri]
1.6.0-b3 - 2007-03-20
---------------------
- Removed tests/runalltests.py and tests/framework.py as they have
outlived their usefulness. To run tests use Zope's testrunner:
./bin/zopectl test --nowarn -s Products.MimetypesRegistry
[stefan]
1.6.0-b2 - 2007-03-05
---------------------
- Use new cmf:registerDirectory zcml directive and removed corresponding code
from the initialize method.
[hannosch]
1.6.0-b1 - 2007-02-27
---------------------
- version bumped to 1.6, 1.5 is now for archetypes 1.4 bugfixing
whatever happens with 1.6.x shouldt have effects on AT 1.4
[jensens]
1.5.0-a1 - 2007-02-06
---------------------
- Implemented PLIP 149
[tomster]
1.4.1-final - 2006-09-15
------------------------
- Converted usage of zLOG to new Python logging module.
[hannosch]
- Mime type links are now urllib quoted. This fixes #682
(http://dev.plone.org/archetypes/ticket/682).
[rocky]
1.4.0-final - 2006-06-16
------------------------
- Use zope.contenttype in favor of zope.app.content_types if available.
[hannosch]
1.4.0-beta2 - 2006-05-12
------------------------
- Use zope.app.content_types in favor of OFS.content_types if available.
[stefan]
- Spring-cleaning of tests infrastructure.
[hannosch]
1.4.0-beta1 - 2006-03-26
------------------------
- fixed Plone #5027: MimeTypeRegistry.classify doesn't handle
"no mimetype" gracefully. Returns 'None' now.
[jensens]
- fixed http://dev.plone.org/archetypes/ticket/622
[jensens]
1.4.0-alpha02 - 2006-02-23
--------------------------
- ensured that the key gotten back from windows_mimetypes.py existed
mark says the best way is to examine each key to ensure its valid but
would be slower.
[runyaga]
- removed odd archetypes 1.3 style version checking
[jensens]
- Removed BBB code for CMFCorePermissions import location.
[hannosch]
- removed deprecation warning for ToolInit.
[jensens]
- skip backward compatibility to the times where MTR where part of
PortalTransforms.
[jensens]
1.3.8-final02 - 2006-01-15
--------------------------
- nothing - the odd version checking needs a version change to stick to
Archetypes version again.
[yenzenz]
1.3.8-RC1 - 2005-12-29
----------------------
- Split yet another part of register() into a separate
method. Cleanup smi_mimetypes initialize a little bit to to use
the new method when adding new mimetypes to a already-registered
entry.
[dreamcatcher]
- Include aliases in the list of mimetypes for a entry. Based on
patch by Jean Jordaan
[dreamcatcher]
- Use a SAX-based parser instead of minidom to improve Zope startup
time (by 17 seconds on my Pismo) and memory footprint.
[dreamcatcher]
- Augment known mimetypes with Windows mimetypes, if available.
[dreamcatcher]
1.3.7-final01 - 2005-10-11
--------------------------
- For the sake of sanity, include a 'mime.types' with
MimetypesRegistry to minimize the platform-specific differences in
mime detection when the python 'mimetypes' module is involved.
[dreamcatcher]
- globs from freedesktop.org shared-mime-info were incorrectly
mapped to 'extensions' and never really worked because the code
tried to strip a leading dot, where the globs normally had ``*.``.
The side-effect of this is that in unix, the Python 'mimetypes'
module would happily read '/etc/mime.types' and gracefully work
(/etc/mime.types has most of the extensions of shared-mime-info
but a few), where on Windows it would fail to detect mimetypes by
extension.
[dreamcatcher]
- Added support for real globs, using fnmatch.translate and
re.compile and a migration function that will be run from Plone
2.1.1 migration, with some tests specific for globs read from
shared-mime-info.
[dreamcatcher]
1.3.6-final01 - 2005-08-30
--------------------------
- after one night sleeping over it I removed the yesterday added method.
therefore I added according to some heuristics and OOo-Documentation
some magic bytes to magic.py and made better tests.
[yenzenz]
- added a method to detect mimetypes of zipped files,
here specialy for OOo now all Openofice files and zip
files are detected properly. my simple tests are working:
a OOo-Writer and a simpe zipfile are detected.
[yenzenz]
- updated freedesktop.org.xml file to latest CVS version rev 1.57 from
http://cvs.freedesktop.org/mime/shared-mime-info/freedesktop.org.xml
[yenzenz]
1.3.5-final03 - 2005-08-07
--------------------------
- nothing - the odd version checking needs a version change to stick to
Archetypes version again.
[yenzenz]
1.3.5-final02 - 2005-08-01
--------------------------
- nothing again, need to stick to Archetypes version
[yenzenz]
1.3.5-final - 2005-07-17
------------------------
- Added Five/Zope3 interface bridges and implements
[tiran]
1.3.4-final - 2005-07-06
------------------------
- added icons for openoffice.org files
[yenzenz]
1.3.3-final06 - 2005-05-20
--------------------------
- nothing (I hate to write this. But the odd version checking needs it).
[yenzenz]
1.3.3-final-02 - 2005-03-25
---------------------------
- nothing
1.3.3-final - 2005-03-05
------------------------
- More a workaround than a fix for [ 1056252 ] Content type algorithm
can be confused.
[tiran]
- workaround for [ 1068001 ] BaseUnit Encoding Error: macintosh
[yenzenz]
- In the case all else fails, try to resort to guess_content_type so
that at least we don't get 'text/plain' when the file is in fact a
binary file.
[dreamcatcher]
1.3.2-5 - 2004-09-30
--------------------
- nothing
1.3.2-4 - 2004-09-30
--------------------
- nothing
1.3.2-3 - 2004-09-25
--------------------
- nothing
1.3.2-2 - 2004-09-17
--------------------
- nothing
1.3.2-1 - 2004-09-04
--------------------
- Cleaned up major parts of PT by removing the python only implementation which
was broken anyway
[tiran]
1.3.1-1 - 2004-08-16
--------------------
- Added text/x-html-safe mime type for new transformation
[tiran]
- Don't return acquisition wrapped mimetype items beause they may lead to
memory leaks.
[tiran]
1.3.0-3 - 2004-08-06
--------------------
- Added text/wiki mime type
[tiran]
- Don't log redefine warning if the currrent and the new object are equal
[tiran]
- initialize() MTR on __setstate__ aka when the MTR is loaded from ZODB.
[tiran]
1.3.0-2 - 2004-07-29
--------------------
- Changed version to stick to Archetypes version.
[tiran]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Products.MimetypesRegistry-2.0.7.zip
(422.3 kB
view hashes)
Close
Hashes for Products.MimetypesRegistry-2.0.7.zip
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6f8c96b2c1f8cd54588bf18d4328b51365de807506224ba2d992c4bdbab51dc9 |
|
MD5 | 9e4e3b19630425308c5ff8f071c01372 |
|
BLAKE2b-256 | 482a594c71422d619cc8d16f839ec5ebeb4109afa4e3e930b3f3dd206889a044 |