Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Xiaowu Zhang
erp5
Commits
482d1631
Commit
482d1631
authored
Sep 17, 2024
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
patches/MimetypesRegistry: add OnlyOffice MIME types.
parent
a5645402
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
0 deletions
+33
-0
product/ERP5Type/patches/MimetypesRegistry.py
product/ERP5Type/patches/MimetypesRegistry.py
+33
-0
No files found.
product/ERP5Type/patches/MimetypesRegistry.py
View file @
482d1631
from
Products.MimetypesRegistry
import
MimeTypesRegistry
,
mime_types
from
Products.MimetypesRegistry
import
MimeTypesRegistry
,
mime_types
from
Products.MimetypesRegistry.MimeTypeItem
import
MimeTypeItem
import
six
import
six
preferred_extension_dict
=
{
preferred_extension_dict
=
{
...
@@ -9,6 +10,30 @@ preferred_extension_dict = {
...
@@ -9,6 +10,30 @@ preferred_extension_dict = {
"tar"
:
"application/x-tar"
,
"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
):
def
initialize
(
registry
):
mime_types
.
initialize
(
registry
)
mime_types
.
initialize
(
registry
)
for
ext
,
mime
in
six
.
iteritems
(
preferred_extension_dict
):
for
ext
,
mime
in
six
.
iteritems
(
preferred_extension_dict
):
...
@@ -18,5 +43,13 @@ def initialize(registry):
...
@@ -18,5 +43,13 @@ def initialize(registry):
x
.
remove
(
ext
)
x
.
remove
(
ext
)
x
.
insert
(
0
,
ext
)
x
.
insert
(
0
,
ext
)
mime
.
extensions
=
tuple
(
x
)
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
MimeTypesRegistry
.
initialize
=
initialize
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment