[Zope] Zope and mime types ???

Oliver Bleutgen Oliver Bleutgen <myzope@gmx.net>
Wed, 10 Oct 2001 10:47:18 +0200


> Neither browser-reported mime types (which, on Windows, are based on
> extensions) nor extensions themselves are reliable. Extensions might be
> more
> reliable in your environment. An occasional inconsistency may or may not
> be
> a serious problem for you and your users. I just wait until someone
> complains about not being able to launch the right application to read a
> document, then I fix it manually.

> If an occasional inconsistency is not tolerable, you might want to write
> code for Zope that tries to be more precise. It might compare extension to
> mime-type and report inconsistencies.  Or it might examine file content
> (good luck!) and set mime-type accordingly. If you do so, please tell us
> what you come up with.


One could use file(1) on *nix systems to analyze file content.
It shouldn't be too hard to reimplement the needed parts of file(1)
in python, because afaik it mainly uses the /etc/magic (/usr/lib/magic)
database to do it's job.
I just checked, and it is capable of recongnizing word,excel and rtf files,
and won't be irritated by extensions.

cheers,
oliver