Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
cloudooo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
cloudooo
Commits
72da57bf
Commit
72da57bf
authored
Apr 23, 2023
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ooo: target libreoffice 7.5
( tested with 7.5.2.2 )
parent
fbd8591e
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
299 additions
and
216 deletions
+299
-216
cloudooo/handler/ooo/mimemapper.py
cloudooo/handler/ooo/mimemapper.py
+10
-4
cloudooo/handler/ooo/tests/testOooAllFormatERP5Compatibility.py
...oo/handler/ooo/tests/testOooAllFormatERP5Compatibility.py
+5
-0
cloudooo/handler/ooo/tests/testOooHandler.py
cloudooo/handler/ooo/tests/testOooHandler.py
+208
-118
cloudooo/handler/ooo/tests/testOooMimemapper.py
cloudooo/handler/ooo/tests/testOooMimemapper.py
+60
-88
cloudooo/handler/ooo/tests/testOooServer.py
cloudooo/handler/ooo/tests/testOooServer.py
+13
-5
cloudooo/handler/ooo/tests/testOooUnoMimemapper.py
cloudooo/handler/ooo/tests/testOooUnoMimemapper.py
+1
-1
cloudooo/manager.py
cloudooo/manager.py
+2
-0
No files found.
cloudooo/handler/ooo/mimemapper.py
View file @
72da57bf
...
...
@@ -85,6 +85,7 @@ class MimeMapper:
alternative_extension_dict
=
{
'Microsoft Excel 2007 XML'
:
'ms.xlsx'
,
'Microsoft Excel 2007-2013 XML'
:
'ms.xlsx'
,
'Excel 2007–365'
:
'ms.xlsx'
,
'Microsoft Excel 5.0'
:
'5.xls'
,
'Microsoft Excel 95'
:
'95.xls'
,
'Microsoft PowerPoint 2007 XML AutoPlay'
:
'ms.ppsx'
,
...
...
@@ -93,8 +94,10 @@ class MimeMapper:
'Microsoft PowerPoint 2007-2013 XML'
:
'ms.pptx'
,
'Microsoft Word 2007 XML'
:
'ms.docx'
,
'Microsoft Word 2007-2013 XML'
:
'ms.docx'
,
'Word 2007–365'
:
'ms.docx'
,
'Microsoft Word 6.0'
:
'6.doc'
,
'Microsoft Word 95'
:
'95.doc'
,
'TIFF - Tagged Image File Format'
:
'tiff'
,
}
uno_path
=
kw
.
get
(
"uno_path"
,
environ
.
get
(
'uno_path'
))
office_binary_path
=
kw
.
get
(
"office_binary_path"
,
...
...
@@ -115,14 +118,15 @@ class MimeMapper:
filter_dict
,
type_dict
=
json
.
loads
(
stdout
)
ooo_disable_filter_list
=
kw
.
get
(
"ooo_disable_filter_list"
)
or
[]
+
[
#
'writer_jpg_Export', # Seems not working from cloudooo in Libre Office 4.3.3.
2
# 'writer_png_Export', # Seems not working from cloudooo in Libre Office 4.3.3.2
# 'draw_eps_Export', # Seems not working from cloudooo in Libre Office 5.0.0.5
# 'impress_eps_Export', # Seems not working from cloudooo in Libre Office 5.0.0.5
#
https://bugs.documentfoundation.org/show_bug.cgi?id=11725
2
'writer_web_jpg_Export'
,
'writer_web_png_Export'
,
'writer_web_webp_Export'
,
]
ooo_disable_filter_name_list
=
kw
.
get
(
"ooo_disable_filter_name_list"
)
or
[]
+
[
'Text'
,
# Use 'Text - Choose Encoding' instead
'Text (StarWriter/Web)'
,
# Use 'Text - Choose Encoding (Writer/Web)' instead
'ODF Drawing (Impress)'
,
# broken for presentation
]
for
filter_name
,
value
in
filter_dict
.
items
():
if
filter_name
in
ooo_disable_filter_list
:
...
...
@@ -130,6 +134,8 @@ class MimeMapper:
ui_name
=
value
.
get
(
'UIName'
)
filter_type
=
value
.
get
(
'Type'
)
filter_type_dict
=
type_dict
.
get
(
filter_type
)
if
not
filter_type_dict
:
continue
if
not
ui_name
:
ui_name
=
filter_type_dict
.
get
(
"UIName"
)
if
ui_name
in
ooo_disable_filter_name_list
or
'Template'
in
ui_name
:
...
...
cloudooo/handler/ooo/tests/testOooAllFormatERP5Compatibility.py
View file @
72da57bf
...
...
@@ -72,4 +72,9 @@ class TestAllFormatsERP5Compatibility(TestCase):
data_output
=
data_output
[
'data'
]
file_type
=
self
.
_getFileType
(
data_output
)
self
.
assertNotIn
(
": empty"
,
file_type
)
if
source_format
!=
extension
:
# when no filter exist for destination format, the document is not converted
# but silently returned in source format, the assertion below should detect
# this.
self
.
assertNotEqual
(
source_mimetype
,
file_type
)
cloudooo/handler/ooo/tests/testOooHandler.py
View file @
72da57bf
This diff is collapsed.
Click to expand it.
cloudooo/handler/ooo/tests/testOooMimemapper.py
View file @
72da57bf
This diff is collapsed.
Click to expand it.
cloudooo/handler/ooo/tests/testOooServer.py
View file @
72da57bf
...
...
@@ -49,9 +49,14 @@ class TestAllowedExtensions(TestCase):
ui_name. The request is by document type as text"""
text_request
=
{
'document_type'
:
"text"
}
text_allowed_list
=
self
.
proxy
.
getAllowedExtensionList
(
text_request
)
# XXX slightly different allowed formats with document_type !?
_text_expected_tuple
=
text_expected_tuple
+
(
(
'docm'
,
'Word 2007–365 VBA'
),
(
'webp'
,
'WEBP - WebP Image'
),
)
self
.
assertEqual
(
sorted
([
tuple
(
x
)
for
x
in
text_allowed_list
]),
sorted
(
text_expected_tuple
))
sorted
([
tuple
(
x
)
for
x
in
text_allowed_list
]),
sorted
(
_
text_expected_tuple
))
def
testGetAllowedPresentationExtensionListByType
(
self
):
"""Verify if getAllowedExtensionList returns is a list with extension and
...
...
@@ -59,14 +64,17 @@ class TestAllowedExtensions(TestCase):
request_dict
=
{
'document_type'
:
"presentation"
}
presentation_allowed_list
=
self
.
proxy
.
getAllowedExtensionList
(
request_dict
)
self
.
assertTrue
(
presentation_allowed_list
)
for
arg
in
presentation_allowed_list
:
self
.
assertIn
(
tuple
(
arg
),
presentation_expected_tuple
)
self
.
assertEqual
(
sorted
([
tuple
(
x
)
for
x
in
presentation_allowed_list
]),
sorted
(
presentation_expected_tuple
))
def
testGetAllowedExtensionListByExtension
(
self
):
"""Verify if getAllowedExtensionList returns is a list with extension and
ui_name. The request is by extension"""
doc_allowed_list
=
self
.
proxy
.
getAllowedExtensionList
({
'extension'
:
"doc"
})
self
.
assertEqual
(
sorted
([
tuple
(
x
)
for
x
in
doc_allowed_list
]),
sorted
(
text_expected_tuple
))
self
.
assertEqual
(
sorted
([
tuple
(
x
)
for
x
in
doc_allowed_list
]),
sorted
(
text_expected_tuple
))
def
testGetAllowedExtensionListByMimetype
(
self
):
"""Verify if getAllowedExtensionList returns is a list with extension and
...
...
cloudooo/handler/ooo/tests/testOooUnoMimemapper.py
View file @
72da57bf
...
...
@@ -99,7 +99,7 @@ class TestUnoMimeMapper(HandlerTestCase):
def
testWithoutOpenOffice
(
self
):
"""Test when the openoffice is stopped"""
error_msg
=
"couldn
\
'
t connect to socket
(Success)
\
n
"
error_msg
=
"couldn
\
'
t connect to socket"
hostname
,
host
=
openoffice
.
getAddress
()
openoffice
.
stop
()
python
=
path
.
join
(
self
.
office_binary_path
,
"python"
)
...
...
cloudooo/manager.py
View file @
72da57bf
...
...
@@ -80,9 +80,11 @@ def BBB_guess_extension(mimetype, title=None):
"Flat XML ODF Text Document"
:
".fodt"
,
"MET - OS/2 Metafile"
:
".met"
,
"Microsoft Excel 2007-2013 XML"
:
".ms.xlsx"
,
"Excel 2007–365"
:
".ms.xlsx"
,
"Microsoft PowerPoint 2007-2013 XML"
:
".ms.pptx"
,
"Microsoft PowerPoint 2007-2013 XML AutoPlay"
:
".ms.ppsx"
,
"Microsoft Word 2007-2013 XML"
:
".ms.docx"
,
"Word 2007–365"
:
".ms.docx"
,
}.
get
(
title
,
None
)
or
{
# mediatype : extension
"application/msword"
:
".doc"
,
...
...
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