From dea27d748214f47bd2d64072076c690c05425ae1 Mon Sep 17 00:00:00 2001 From: helmutm Date: Mon, 16 Aug 2010 08:27:22 +0000 Subject: [PATCH] provide additional mime types (MS Office 2007) git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@3959 fd906abe-77d9-0310-91a1-e0d9ade77398 --- integrator/base.py | 7 ++++++- integrator/filesystem.txt | 9 +++++++++ integrator/mime.types | 3 +++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/integrator/base.py b/integrator/base.py index bffa666..3a7b557 100644 --- a/integrator/base.py +++ b/integrator/base.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2008 Helmut Merz helmutm@cy55.de +# Copyright (c) 2010 Helmut Merz helmutm@cy55.de # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -22,6 +22,7 @@ Base implementation for accessing external content objects. $Id$ """ +import mimetypes import os from urllib import urlencode from zope.app.container.contained import Contained @@ -210,3 +211,7 @@ class MimeTypes(dict): mtFile.close() mimeTypes = MimeTypes() + + +mimetypes.init(mimetypes.knownfiles + + [os.path.join(os.path.dirname(__file__), 'mime.types')]) diff --git a/integrator/filesystem.txt b/integrator/filesystem.txt index 6c23211..401ae86 100644 --- a/integrator/filesystem.txt +++ b/integrator/filesystem.txt @@ -110,3 +110,12 @@ A file object has additional attributes/methods. >>> html.icon 'html' + +MIMETypes +========= + + >>> import mimetypes + >>> mimetypes.guess_type('test.xlsx') + ('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', None) + >>> mimetypes.guess_type('test.xlsm') + ('application/vnd.ms-excel.sheet.macroEnabled.12', None) diff --git a/integrator/mime.types b/integrator/mime.types index 7cc9a3c..e2758ac 100644 --- a/integrator/mime.types +++ b/integrator/mime.types @@ -217,6 +217,7 @@ application/vnd.mozilla.xul+xml xul application/vnd.ms-artgalry application/vnd.ms-asf application/vnd.ms-excel xls xlb xlt +application/vnd.ms-excel.sheet.macroEnabled.12 xlsm application/vnd.ms-lrm application/vnd.ms-pki.seccat cat application/vnd.ms-pki.stl stl @@ -249,6 +250,8 @@ application/vnd.oasis.opendocument.text odt application/vnd.oasis.opendocument.text-master odm application/vnd.oasis.opendocument.text-template ott application/vnd.oasis.opendocument.text-web oth +application/vnd.openxmlformats-officedocument.wordprocessingml.document docx +application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx application/vnd.osa.netdeploy application/vnd.palm application/vnd.pg.format