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
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
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Carlos Ramos Carreño
erp5
Commits
0ba6a109
Commit
0ba6a109
authored
Feb 11, 2024
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ERP5OOo: py3
parent
fa78a36c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
12 additions
and
7 deletions
+12
-7
bt5/erp5_base/DocumentTemplateItem/portal_components/document.erp5.OOoDocument.py
...mplateItem/portal_components/document.erp5.OOoDocument.py
+8
-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 @
0ba6a109
...
...
@@ -38,8 +38,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 +334,12 @@ 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'
)
return
mime
,
data
security
.
declareProtected
(
Permissions
.
ModifyPortalContent
,
'_populateConversionCacheWithHTML'
)
...
...
product/ERP5OOo/transforms/odt_to_doc.py
View file @
0ba6a109
...
...
@@ -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 @
0ba6a109
...
...
@@ -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 @
0ba6a109
...
...
@@ -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 @
0ba6a109
...
...
@@ -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