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
51a05519
Commit
51a05519
authored
Feb 11, 2024
by
Jérome Perrin
Committed by
Arnaud Fontaine
Jul 05, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ERP5OOo: py3
parent
ed93f84f
Changes
5
Hide 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 @
51a05519
...
@@ -29,6 +29,7 @@
...
@@ -29,6 +29,7 @@
import
re
,
zipfile
import
re
,
zipfile
from
io
import
BytesIO
from
io
import
BytesIO
import
six
from
warnings
import
warn
from
warnings
import
warn
from
AccessControl
import
ClassSecurityInfo
from
AccessControl
import
ClassSecurityInfo
from
OFS.Image
import
Pdata
from
OFS.Image
import
Pdata
...
@@ -38,8 +39,8 @@ from Products.ERP5Type import Permissions, PropertySheet
...
@@ -38,8 +39,8 @@ from Products.ERP5Type import Permissions, PropertySheet
from
Products.ERP5Type.Cache
import
CachingMethod
from
Products.ERP5Type.Cache
import
CachingMethod
from
erp5.component.document.File
import
File
from
erp5.component.document.File
import
File
from
erp5.component.document.Document
import
Document
,
\
from
erp5.component.document.Document
import
Document
,
\
VALID_IMAGE_FORMAT_LIST
,
ConversionError
,
NotConvertedError
VALID_IMAGE_FORMAT_LIST
,
VALID_TEXT_FORMAT_LIST
,
ConversionError
,
NotConvertedError
from
Products.ERP5Type.Utils
import
bytes2str
,
fill_args_from_request
,
str2bytes
from
Products.ERP5Type.Utils
import
guessEncodingFromText
,
bytes2str
,
fill_args_from_request
,
str2bytes
# Mixin Import
# Mixin Import
from
erp5.component.mixin.BaseConvertableFileMixin
import
BaseConvertableFileMixin
from
erp5.component.mixin.BaseConvertableFileMixin
import
BaseConvertableFileMixin
...
@@ -334,7 +335,14 @@ class OOoDocument(OOoDocumentExtensibleTraversableMixin, BaseConvertableFileMixi
...
@@ -334,7 +335,14 @@ class OOoDocument(OOoDocumentExtensibleTraversableMixin, BaseConvertableFileMixi
# store conversion
# store conversion
self
.
setConversion
(
data
,
mime
,
format
=
original_format
,
**
kw
)
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
,
security
.
declareProtected
(
Permissions
.
ModifyPortalContent
,
'_populateConversionCacheWithHTML'
)
'_populateConversionCacheWithHTML'
)
...
...
product/ERP5OOo/transforms/odt_to_doc.py
View file @
51a05519
...
@@ -27,7 +27,7 @@ class OdtToDoc:
...
@@ -27,7 +27,7 @@ class OdtToDoc:
raise
AttributeError
(
attr
)
raise
AttributeError
(
attr
)
def
convert
(
self
,
orig
,
data
,
cache
=
None
,
filename
=
None
,
context
=
None
,
**
kwargs
):
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
])
doc
=
OOOdCommandTransform
(
context
,
filename
,
data
,
self
.
inputs
[
0
])
msword
=
doc
.
convertTo
(
'doc'
)
msword
=
doc
.
convertTo
(
'doc'
)
if
cache
is
not
None
:
if
cache
is
not
None
:
...
...
product/ERP5OOo/transforms/odt_to_pdf.py
View file @
51a05519
...
@@ -27,7 +27,7 @@ class OdtToPdf:
...
@@ -27,7 +27,7 @@ class OdtToPdf:
raise
AttributeError
(
attr
)
raise
AttributeError
(
attr
)
def
convert
(
self
,
orig
,
data
,
cache
=
None
,
filename
=
None
,
context
=
None
,
**
kwargs
):
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
])
doc
=
OOOdCommandTransform
(
context
,
filename
,
data
,
self
.
inputs
[
0
])
pdf
=
doc
.
convertTo
(
'pdf'
)
pdf
=
doc
.
convertTo
(
'pdf'
)
if
cache
is
not
None
:
if
cache
is
not
None
:
...
...
product/ERP5OOo/transforms/odt_to_xml.py
View file @
51a05519
...
@@ -28,7 +28,7 @@ class OdtToXml:
...
@@ -28,7 +28,7 @@ class OdtToXml:
raise
AttributeError
(
attr
)
raise
AttributeError
(
attr
)
def
convert
(
self
,
orig
,
data
,
cache
=
None
,
filename
=
None
,
context
=
None
,
**
kwargs
):
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
])
doc
=
OOOdCommandTransform
(
context
,
filename
,
data
,
self
.
inputs
[
0
])
builder
=
OOoBuilder
(
doc
)
builder
=
OOoBuilder
(
doc
)
content
=
builder
.
extract
(
'content.xml'
)
content
=
builder
.
extract
(
'content.xml'
)
...
...
product/ERP5OOo/transforms/oood_commandtransform.py
View file @
51a05519
...
@@ -143,7 +143,7 @@ class OOOdCommandTransform(commandtransform):
...
@@ -143,7 +143,7 @@ class OOOdCommandTransform(commandtransform):
image
=
OFSImage
(
image
.
getId
(),
image
.
getTitle
(),
image_data
)
image
=
OFSImage
(
image
.
getId
(),
image
.
getTitle
(),
image_data
)
# image should be OFSImage
# image should be OFSImage
data
=
str
(
image
.
data
)
data
=
bytes
(
image
.
data
)
width
=
image
.
width
width
=
image
.
width
height
=
image
.
height
height
=
image
.
height
if
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