Commit 482d1631 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

patches/MimetypesRegistry: add OnlyOffice MIME types.

parent a5645402
from Products.MimetypesRegistry import MimeTypesRegistry, mime_types
from Products.MimetypesRegistry.MimeTypeItem import MimeTypeItem
import six
preferred_extension_dict = {
......@@ -9,6 +10,30 @@ preferred_extension_dict = {
"tar": "application/x-tar",
}
additional_mimetype_item_list = (
{
"name": "OnlyOffice Text",
"mimetypes": ("application/x-asc-text",),
"extensions": ("docy",),
"binary": True,
"icon_path": "application.png",
},
{
"name": "OnlyOffice Spreadsheet",
"mimetypes": ("application/x-asc-spreadsheet",),
"extensions": ("xlsy",),
"binary": True,
"icon_path": "application.png",
},
{
"name": "OnlyOffice Presentation",
"mimetypes": ("application/x-asc-presentation",),
"extensions": ("ppty",),
"binary": True,
"icon_path": "application.png",
},
)
def initialize(registry):
mime_types.initialize(registry)
for ext, mime in six.iteritems(preferred_extension_dict):
......@@ -18,5 +43,13 @@ def initialize(registry):
x.remove(ext)
x.insert(0, ext)
mime.extensions = tuple(x)
for item in additional_mimetype_item_list:
registry.manage_addMimeType(
id=item["name"],
mimetypes=item["mimetypes"],
extensions=item["extensions"],
binary=item["binary"],
icon_path=item["icon_path"],
)
MimeTypesRegistry.initialize = initialize
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment