On Thu, Oct 1, 2009 at 4:44 PM, Thomas Lotze <t...@gocept.com> wrote:
> I also wonder whether it might make sense to utilise the /etc/mime.types
> database (or the system's equivalent) for guessing based on the file-name
> extension, and libmagic (if available) for magic-number tests based on
> file contents. But of course, these ideas don't have much to do with the
> restructuring discussed in this thread.

Not related to the restructuring:

Products.MimeTypesRegistry is currently tightly bound to Zope2. But it
does have a far more advanced implementation for mimetype related
functionality, like type guessing and file extension handling.

For mime type information it looks at:

- all information found in the
http://www.freedesktop.org/standards/shared-mime-info database
- magic codes based on gnome-vfs-mime-magic
- information form the Apache mime.types (local copy so it works on Windows)
- respects zope.contenttype and Python's mimetypes module
- on Windows respects the information found in the registry at
"HKEY_CLASSES_ROOT\MIME\Database\Content Type"
- a couple of its own definitions (for example Markdown, Textile, SVG,
new MS Office formats not yet present in the other sources)

If someone really wants to extend the functionality, this package
might be worth a look. The whole persistent registry idea of
MimeTypesRegistry is overkill, but most of the other code should have
little or no external dependencies and should be good after a bit of

Zope-Dev maillist  -  Zope-Dev@zope.org
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope )

Reply via email to