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
Labels
Merge Requests
141
Merge Requests
141
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
53072b0b
Commit
53072b0b
authored
Feb 11, 2024
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ERP5OOo: py3
parent
0e20081b
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
7 deletions
+15
-7
bt5/erp5_base/DocumentTemplateItem/portal_components/document.erp5.OOoDocument.py
...mplateItem/portal_components/document.erp5.OOoDocument.py
+11
-3
product/ERP5OOo/transforms/odt_to_doc.py
product/ERP5OOo/transforms/odt_to_doc.py
+1
-1
product/ERP5OOo/transforms/odt_to_pdf.py
product/ERP5OOo/transforms/odt_to_pdf.py
+1
-1
product/ERP5OOo/transforms/odt_to_xml.py
product/ERP5OOo/transforms/odt_to_xml.py
+1
-1
product/ERP5OOo/transforms/oood_commandtransform.py
product/ERP5OOo/transforms/oood_commandtransform.py
+1
-1
No files found.
bt5/erp5_base/DocumentTemplateItem/portal_components/document.erp5.OOoDocument.py
View file @
53072b0b
...
...
@@ -29,6 +29,7 @@
import
re
,
zipfile
from
io
import
BytesIO
import
six
from
warnings
import
warn
from
AccessControl
import
ClassSecurityInfo
from
OFS.Image
import
Pdata
...
...
@@ -38,8 +39,8 @@ from Products.ERP5Type import Permissions, PropertySheet
from
Products.ERP5Type.Cache
import
CachingMethod
from
erp5.component.document.File
import
File
from
erp5.component.document.Document
import
Document
,
\
VALID_IMAGE_FORMAT_LIST
,
ConversionError
,
NotConvertedError
from
Products.ERP5Type.Utils
import
bytes2str
,
fill_args_from_request
,
str2bytes
VALID_IMAGE_FORMAT_LIST
,
VALID_TEXT_FORMAT_LIST
,
ConversionError
,
NotConvertedError
from
Products.ERP5Type.Utils
import
guessEncodingFromText
,
bytes2str
,
fill_args_from_request
,
str2bytes
# Mixin Import
from
erp5.component.mixin.BaseConvertableFileMixin
import
BaseConvertableFileMixin
...
...
@@ -334,7 +335,14 @@ class OOoDocument(OOoDocumentExtensibleTraversableMixin, BaseConvertableFileMixi
# store conversion
self
.
setConversion
(
data
,
mime
,
format
=
original_format
,
**
kw
)
return
self
.
getConversion
(
format
=
original_format
,
**
kw
)
mime
,
data
=
self
.
getConversion
(
format
=
original_format
,
**
kw
)
if
format
in
VALID_TEXT_FORMAT_LIST
:
# Libreoffice conversions on cloudooo usually have a BOM, we are using guessEncodingFromText
# here mostly as a convenient way to decode with the encoding from BOM
data
=
data
.
decode
(
guessEncodingFromText
(
data
)
or
'ascii'
)
if
six
.
PY2
:
data
=
data
.
encode
(
'utf-8'
)
return
mime
,
data
security
.
declareProtected
(
Permissions
.
ModifyPortalContent
,
'_populateConversionCacheWithHTML'
)
...
...
product/ERP5OOo/transforms/odt_to_doc.py
View file @
53072b0b
...
...
@@ -27,7 +27,7 @@ class OdtToDoc:
raise
AttributeError
(
attr
)
def
convert
(
self
,
orig
,
data
,
cache
=
None
,
filename
=
None
,
context
=
None
,
**
kwargs
):
data
=
str
(
orig
)
data
=
bytes
(
orig
)
doc
=
OOOdCommandTransform
(
context
,
filename
,
data
,
self
.
inputs
[
0
])
msword
=
doc
.
convertTo
(
'doc'
)
if
cache
is
not
None
:
...
...
product/ERP5OOo/transforms/odt_to_pdf.py
View file @
53072b0b
...
...
@@ -27,7 +27,7 @@ class OdtToPdf:
raise
AttributeError
(
attr
)
def
convert
(
self
,
orig
,
data
,
cache
=
None
,
filename
=
None
,
context
=
None
,
**
kwargs
):
data
=
str
(
orig
)
data
=
bytes
(
orig
)
doc
=
OOOdCommandTransform
(
context
,
filename
,
data
,
self
.
inputs
[
0
])
pdf
=
doc
.
convertTo
(
'pdf'
)
if
cache
is
not
None
:
...
...
product/ERP5OOo/transforms/odt_to_xml.py
View file @
53072b0b
...
...
@@ -28,7 +28,7 @@ class OdtToXml:
raise
AttributeError
(
attr
)
def
convert
(
self
,
orig
,
data
,
cache
=
None
,
filename
=
None
,
context
=
None
,
**
kwargs
):
data
=
str
(
orig
)
data
=
bytes
(
orig
)
doc
=
OOOdCommandTransform
(
context
,
filename
,
data
,
self
.
inputs
[
0
])
builder
=
OOoBuilder
(
doc
)
content
=
builder
.
extract
(
'content.xml'
)
...
...
product/ERP5OOo/transforms/oood_commandtransform.py
View file @
53072b0b
...
...
@@ -143,7 +143,7 @@ class OOOdCommandTransform(commandtransform):
image
=
OFSImage
(
image
.
getId
(),
image
.
getTitle
(),
image_data
)
# image should be OFSImage
data
=
str
(
image
.
data
)
data
=
bytes
(
image
.
data
)
width
=
image
.
width
height
=
image
.
height
if
height
:
...
...
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