Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cloudooo
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
Boris Kocherov
cloudooo
Commits
b472db7e
Commit
b472db7e
authored
Jan 20, 2018
by
Boris Kocherov
Committed by
Romain Courteaud
Feb 26, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x2t: getAllowedConversionFormatList return OnlyOffice types too
parent
405454a8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
19 deletions
+33
-19
cloudooo/handler/x2t/handler.py
cloudooo/handler/x2t/handler.py
+27
-10
cloudooo/handler/x2t/tests/testX2tHandler.py
cloudooo/handler/x2t/tests/testX2tHandler.py
+6
-9
No files found.
cloudooo/handler/x2t/handler.py
View file @
b472db7e
...
@@ -205,16 +205,33 @@ class Handler(object):
...
@@ -205,16 +205,33 @@ class Handler(object):
]
]
"""
"""
source_mimetype
=
parseContentType
(
source_mimetype
).
gettype
()
source_mimetype
=
parseContentType
(
source_mimetype
).
gettype
()
if
source_mimetype
in
(
"docx"
,
"application/vnd.openxmlformats-officedocument.wordprocessingml.document"
):
return
[(
"application/x-asc-text"
,
"OnlyOffice Text Document"
)]
if
source_mimetype
in
(
"docy"
,
"application/x-asc-text"
):
if
source_mimetype
in
(
"docy"
,
"application/x-asc-text"
):
return
[(
"application/vnd.openxmlformats-officedocument.wordprocessingml.document"
,
"Word 2007 Document"
)]
return
[
if
source_mimetype
in
(
"xlsx"
,
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
):
(
"application/vnd.openxmlformats-officedocument.wordprocessingml.document"
,
"Word 2007 Document"
),
return
[(
"application/x-asc-spreadsheet"
,
"OnlyOffice Spreadsheet"
)]
(
"application/vnd.oasis.opendocument.text"
,
"ODF Text Document"
),
]
if
source_mimetype
in
(
"xlsy"
,
"application/x-asc-spreadsheet"
):
if
source_mimetype
in
(
"xlsy"
,
"application/x-asc-spreadsheet"
):
return
[(
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
,
"Excel 2007 Spreadsheet"
)]
return
[
if
source_mimetype
in
(
"pptx"
,
"application/vnd.openxmlformats-officedocument.presentationml.presentation"
):
(
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
,
"Excel 2007 Spreadsheet"
),
return
[(
"application/x-asc-presentation"
,
"OnlyOffice Presentation"
)]
(
"application/vnd.oasis.opendocument.spreadsheet"
,
"ODF Spreadsheet Document"
),
]
if
source_mimetype
in
(
"ppty"
,
"application/x-asc-presentation"
):
if
source_mimetype
in
(
"ppty"
,
"application/x-asc-presentation"
):
return
[(
"application/vnd.openxmlformats-officedocument.presentationml.presentation"
,
"PowerPoint 2007 Presentation"
)]
return
[
return
[]
(
"application/vnd.openxmlformats-officedocument.presentationml.presentation"
,
"PowerPoint 2007 Presentation"
),
(
"application/vnd.oasis.opendocument.presentation"
,
"ODF Presentation Document"
),
]
get_format_list
=
OOoHandler
.
getAllowedConversionFormatList
format_list
=
get_format_list
(
source_mimetype
)
format_list_append
=
format_list
.
append
for
f_type
,
_
in
format_list
:
if
f_type
==
"application/vnd.openxmlformats-officedocument.wordprocessingml.document"
:
format_list_append
((
"application/x-asc-text"
,
"OnlyOffice Text Document"
))
break
if
f_type
==
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
:
format_list_append
((
"application/x-asc-spreadsheet"
,
"OnlyOffice Spreadsheet"
))
break
if
f_type
==
"application/vnd.openxmlformats-officedocument.presentationml.presentation"
:
format_list_append
((
"application/x-asc-presentation"
,
"OnlyOffice Presentation"
))
break
return
format_list
cloudooo/handler/x2t/tests/testX2tHandler.py
View file @
b472db7e
...
@@ -104,17 +104,14 @@ class TestHandler(HandlerTestCase):
...
@@ -104,17 +104,14 @@ class TestHandler(HandlerTestCase):
"""
"""
get
=
Handler
.
getAllowedConversionFormatList
get
=
Handler
.
getAllowedConversionFormatList
self
.
assertEquals
(
get
(
"application/x-asc-text;ignored=param"
),
self
.
assertEquals
(
get
(
"application/x-asc-text;ignored=param"
),
[(
"application/vnd.openxmlformats-officedocument.wordprocessingml.document"
,
"Word 2007 Document"
)])
[(
"application/vnd.openxmlformats-officedocument.wordprocessingml.document"
,
"Word 2007 Document"
),
(
'application/vnd.oasis.opendocument.text'
,
'ODF Text Document'
)])
self
.
assertEquals
(
get
(
"application/x-asc-spreadsheet;ignored=param"
),
self
.
assertEquals
(
get
(
"application/x-asc-spreadsheet;ignored=param"
),
[(
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
,
"Excel 2007 Spreadsheet"
)])
[(
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
,
"Excel 2007 Spreadsheet"
),
(
'application/vnd.oasis.opendocument.spreadsheet'
,
'ODF Spreadsheet Document'
)])
self
.
assertEquals
(
get
(
"application/x-asc-presentation;ignored=param"
),
self
.
assertEquals
(
get
(
"application/x-asc-presentation;ignored=param"
),
[(
"application/vnd.openxmlformats-officedocument.presentationml.presentation"
,
"PowerPoint 2007 Presentation"
)])
[(
"application/vnd.openxmlformats-officedocument.presentationml.presentation"
,
"PowerPoint 2007 Presentation"
),
self
.
assertEquals
(
get
(
"application/vnd.openxmlformats-officedocument.wordprocessingml.document;ignored=param"
),
(
'application/vnd.oasis.opendocument.presentation'
,
'ODF Presentation Document'
)])
[(
"application/x-asc-text"
,
"OnlyOffice Text Document"
)])
self
.
assertEquals
(
get
(
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;ignored=param"
),
[(
"application/x-asc-spreadsheet"
,
"OnlyOffice Spreadsheet"
)])
self
.
assertEquals
(
get
(
"application/vnd.openxmlformats-officedocument.presentationml.presentation;ignored=param"
),
[(
"application/x-asc-presentation"
,
"OnlyOffice Presentation"
)])
def
test_suite
():
def
test_suite
():
return
make_suite
(
TestHandler
)
return
make_suite
(
TestHandler
)
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