Zope doesn't know enough mime types.
Yo, Zope doesn't know enough mime types, and there's no easy way to add them add runtime since you removed the add_type(...) method from mimetypes.py mime types that spring to mind are: .ra .ram .rm : audio/x-pn-realaudio .rpm : audio/x-pn-realaudio-plugin .jad : text/vnd.sun.j2me.app-descriptor .jar : application/java-archive I'm sure there must be quite a few others. Maybe someone can add the lot of'em. This also is vaguely related to: http://zope.org/Collectors/Zope/969 TIA, Romain Slootmaekers
Hi Romain,
Yo,
Zope doesn't know enough mime types, and there's no easy way to add them add runtime since you removed the add_type(...) method from mimetypes.py
Who is "you" which has removed the function? I guess mimetypes is a core python module ... Anyway if You feel the need to add content types to the global mimetypes map, You can do this manually in Your custom product __init__.py, e.g.: from mimetypes import types_map types_map['.ra'] = 'audio/x-pn-realaudio' # etcetcetc I guess this is not worse than letting Zope to the patches. Cheers, Clemens
Clemens Robbenhaar wrote:
Hi Romain,
Yo,
Zope doesn't know enough mime types, and there's no easy way to add them add runtime since you removed the add_type(...) method from mimetypes.py
Who is "you" which has removed the function? I guess mimetypes is a core python module ...
you = zope development team mimtypes IS a core python module, but zope feels compelled to deliver us a modified version with less functionality (and probably has good reasons to do so). But why the modified mimetypes file has to contain about 40 less mime-types than the corresponding file in a python installation from python.org is a mistery to me.
Anyway if You feel the need to add content types to the global mimetypes map, You can do this manually in Your custom product __init__.py, e.g.:
from mimetypes import types_map types_map['.ra'] = 'audio/x-pn-realaudio' # etcetcetc
I guess this is not worse than letting Zope to the patches.
(Monkey)patching zope(s) to workaround (bugs | missing features) is indeed sometimes needed but if the fix is as simple as adding some name-value pairs I see no reason why not to do this before the next release. Romain.
Cheers, Clemens
Romain Slootmaekers writes:
But why the modified mimetypes file has to contain about 40 less mime-types than the corresponding file in a python installation from python.org is a mistery to me.
The mimetypes module in general has a problem: the known MIME types are stored in the source code. The table in the module has definately been extended over time; make sure you're looking at the right version of the module from python.org. The module *tries* to load definitions from known external lists of MIME types (as would have been installed with Apache or Netscape), but isn't guaranteed to find these external lists (they not be installed, or may be installed in atypical locations). Adding some configuration to Zope to identify additional mime.types files to load may be a good idea, and should not be too difficult. -Fred -- Fred L. Drake, Jr. <fred at zope.com> PythonLabs at Zope Corporation
I wrote:
Adding some configuration to Zope to identify additional mime.types files to load may be a good idea, and should not be too difficult.
I've done this on the Zope 2 head; I don't know if it should be ported to the Zope 2.7 branch. Zope's configuration file can now have an additional key, "mime-types", which specifies an additional file of MIME type associations to filename extensions. The key may be given more than once if desired. The MIME type associations are specified in the same way as in Apache's mime.types file. Each line in the file may be blank, a comment starting with "#", or a type association: foo/bar ext foo/bat foo/baz ext1 ext2 ext3 -Fred -- Fred L. Drake, Jr. <fred at zope.com> PythonLabs at Zope Corporation
would be nice if we had it in 2.7 Robert Am Donnerstag, 30. Oktober 2003 17:50 schrieb Fred L. Drake, Jr.:
I wrote:
Adding some configuration to Zope to identify additional mime.types files to load may be a good idea, and should not be too difficult.
I've done this on the Zope 2 head; I don't know if it should be ported to the Zope 2.7 branch.
Zope's configuration file can now have an additional key, "mime-types", which specifies an additional file of MIME type associations to filename extensions. The key may be given more than once if desired.
The MIME type associations are specified in the same way as in Apache's mime.types file. Each line in the file may be blank, a comment starting with "#", or a type association:
foo/bar ext foo/bat foo/baz ext1 ext2 ext3
-Fred
-- mit freundlichen GrĂ¼ssen Robert Rottermann www.redCOR.ch
robert writes:
would be nice if we had it in 2.7
That's up to Brian Lloyd. I think it's a low-risk change, but we really want to stabilize and finish 2.7. -Fred -- Fred L. Drake, Jr. <fred at zope.com> PythonLabs at Zope Corporation
fyi, I'm ok with merging this to 2.7 if it already is on the HEAD, has tests, and has at least some minimal docs. Brian Lloyd brian@zope.com V.P. Engineering 540.361.1716 Zope Corporation http://www.zope.com
-----Original Message----- From: zope-dev-bounces@zope.org [mailto:zope-dev-bounces@zope.org]On Behalf Of Fred L. Drake, Jr. Sent: Thursday, October 30, 2003 11:42 PM To: robert Cc: Zope Developers list; Romain Slootmaekers Subject: Re: [Zope-dev] Zope doesn't know enough mime types.
robert writes:
would be nice if we had it in 2.7
That's up to Brian Lloyd. I think it's a low-risk change, but we really want to stabilize and finish 2.7.
-Fred
-- Fred L. Drake, Jr. <fred at zope.com> PythonLabs at Zope Corporation
_______________________________________________ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Brian Lloyd writes:
fyi, I'm ok with merging this to 2.7 if it already is on the HEAD, has tests, and has at least some minimal docs.
It's on the head, and I've performed a check on a running Zope process that new types specified this way are recognized. I'll check in unit tests of the lower-level functionality that supports the feature shortly. The feature is documented in the configuration schema, and I'll add something to the example configuration about it as well. -Fred -- Fred L. Drake, Jr. <fred at zope.com> PythonLabs at Zope Corporation
Oo, oo, Fred. I just checked in a feature on the HEAD only that lets you configure Python warning filters using the config file. I think it passes Brian's criterion for merge save for any tests. It would be nice to have all the config stuff the same on HEAD as on 2.7 so we don't run into merge problems later... If we agree and I promise to write a test for the warnfilter, maybe you could just copy the zconfig schemas and datatype files from the HEAD for the Zope.Startup package and the zLOG package and merge that way instead of surgically porting the mimetypes stuff to the 2.7 branch. The zope.conf.in file needs to be merged as well. - C On Fri, 2003-10-31 at 10:46, Fred L. Drake, Jr. wrote:
Brian Lloyd writes:
fyi, I'm ok with merging this to 2.7 if it already is on the HEAD, has tests, and has at least some minimal docs.
It's on the head, and I've performed a check on a running Zope process that new types specified this way are recognized. I'll check in unit tests of the lower-level functionality that supports the feature shortly. The feature is documented in the configuration schema, and I'll add something to the example configuration about it as well.
-Fred
Chris McDonough writes:
Oo, oo, Fred. I just checked in a feature on the HEAD only that lets you configure Python warning filters using the config file. I think it passes Brian's criterion for merge save for any tests.
The MIME types support now passes Brian's criteria; I finally added a stanza to the zope.conf.in file that describes it.
It would be nice to have all the config stuff the same on HEAD as on 2.7 so we don't run into merge problems later... If we agree and I promise to write a test for the warnfilter, maybe you could just copy the
Have you written these tests yet?
zconfig schemas and datatype files from the HEAD for the Zope.Startup package and the zLOG package and merge that way instead of surgically porting the mimetypes stuff to the 2.7 branch. The zope.conf.in file needs to be merged as well.
What was affected in zLOG? I'm glad to port these features to Zope 2.7 if you've got the tests ready and Brian thinks that makes sense. -Fred -- Fred L. Drake, Jr. <fred at zope.com> PythonLabs at Zope Corporation
On Tue, 2003-11-04 at 12:06, Fred L. Drake, Jr. wrote:
It would be nice to have all the config stuff the same on HEAD as on 2.7 so we don't run into merge problems later... If we agree and I promise to write a test for the warnfilter, maybe you could just copy the
Have you written these tests yet?
<stares downwards and kicks at dirt on the ground> No...
zconfig schemas and datatype files from the HEAD for the Zope.Startup package and the zLOG package and merge that way instead of surgically porting the mimetypes stuff to the 2.7 branch. The zope.conf.in file needs to be merged as well.
What was affected in zLOG?
Thats where I defined the sectiontype.
I'm glad to port these features to Zope 2.7 if you've got the tests ready and Brian thinks that makes sense.
OK, I'll try to do that today. - C
On Tue, 2003-11-04 at 12:22, Fred L. Drake, Jr. wrote:
Chris McDonough writes:
Thats where I defined the sectiontype.
I don't think it belongs there; it really has nothing to do with the logging.
I was thinking that too after I did it. ;-) I'll move it to Zope.Startup. - C
Chris McDonough writes:
I was thinking that too after I did it. ;-) I'll move it to Zope.Startup.
Cool. I'll be so bold as to suggest using a separate ZConfig component instead of sticking the section definition in the main schema. If you define the section type in warningfilter.xml, import it using <import package="Zope.Startup" file="warningfilter.xml" /> in the main schema. Any datatype or handler functions can then be in a separate module within Zope.Startup as well, keeping it nicely compartmentalized. -Fred -- Fred L. Drake, Jr. <fred at zope.com> PythonLabs at Zope Corporation
On Fri, 2003-10-24 at 11:48, Romain Slootmaekers wrote:
[...]
(Monkey)patching zope(s) to workaround (bugs | missing features) is indeed sometimes needed but if the fix is as simple as adding some name-value pairs I see no reason why not to do this before the next release.
Put it in the collector. -- Ideas don't stay in some minds very long because they don't like solitary confinement.
On Fri, 2003-10-24 at 09:03, Romain Slootmaekers wrote:
Yo,
Zope doesn't know enough mime types, and there's no easy way to add them add runtime since you removed the add_type(...) method from mimetypes.py
mime types that spring to mind are:
.ra .ram .rm : audio/x-pn-realaudio .rpm : audio/x-pn-realaudio-plugin
Note that this entry is ambiguous: Real's use of the already-conventional '.rpm' (the extension for RPM pacakges) for their own plugins is obnoxious. I *wouldn't* agree that we should wire that into Zope.
.jad : text/vnd.sun.j2me.app-descriptor .jar : application/java-archive
I'm sure there must be quite a few others. Maybe someone can add the lot of'em.
This also is vaguely related to: http://zope.org/Collectors/Zope/969
Tres. -- =============================================================== Tres Seaver tseaver@zope.com Zope Corporation "Zope Dealers" http://www.zope.com
Tres Seaver wrote:
On Fri, 2003-10-24 at 09:03, Romain Slootmaekers wrote:
Yo,
Zope doesn't know enough mime types, and there's no easy way to add them add runtime since you removed the add_type(...) method from mimetypes.py
mime types that spring to mind are:
.ra .ram .rm : audio/x-pn-realaudio .rpm : audio/x-pn-realaudio-plugin
Note that this entry is ambiguous: Real's use of the already-conventional '.rpm' (the extension for RPM pacakges) for their own plugins is obnoxious. I *wouldn't* agree that we should wire that into Zope.
as it turns out, it is ambiguous, but neither Red Hat nor Real have an .rpm entry on the official list. but that's not surprising either, since that one was last updated in 2001. http://www.isi.edu/in-notes/iana/assignments/media-types/media-types
.jad : text/vnd.sun.j2me.app-descriptor .jar : application/java-archive
I'm sure there must be quite a few others. Maybe someone can add the lot of'em.
This also is vaguely related to: http://zope.org/Collectors/Zope/969
Tres.
participants (8)
-
Brian Lloyd -
Chris McDonough -
Clemens Robbenhaar -
Fred L. Drake, Jr. -
Leonardo Rochael Almeida -
robert -
Romain Slootmaekers -
Tres Seaver