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
Titouan Soulard
erp5
Commits
15219e6d
Commit
15219e6d
authored
Aug 12, 2024
by
Jérome Perrin
Committed by
Arnaud Fontaine
Oct 15, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
py3: cloudooo.git/d4abf3ff: convertFile() take an str() and returns an str() (
!1751
).
parent
4e36a8fd
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
8 deletions
+16
-8
bt5/erp5_base/ModuleComponentTemplateItem/portal_components/module.erp5.TransformLib.py
...emplateItem/portal_components/module.erp5.TransformLib.py
+4
-3
bt5/erp5_corporate_identity/ExtensionTemplateItem/portal_components/extension.erp5.TemplateDocumentConversion.py
...l_components/extension.erp5.TemplateDocumentConversion.py
+2
-1
bt5/erp5_web/ModuleComponentTemplateItem/portal_components/module.erp5.TransformHtmlToPdf.py
...eItem/portal_components/module.erp5.TransformHtmlToPdf.py
+6
-2
product/ERP5/bootstrap/erp5_core/MixinTemplateItem/portal_components/mixin.erp5.MailMessageMixin.py
...lateItem/portal_components/mixin.erp5.MailMessageMixin.py
+2
-0
product/ERP5OOo/transforms/oood_commandtransform.py
product/ERP5OOo/transforms/oood_commandtransform.py
+2
-2
No files found.
bt5/erp5_base/ModuleComponentTemplateItem/portal_components/module.erp5.TransformLib.py
View file @
15219e6d
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
from
Products.PortalTransforms.interfaces
import
ITransform
from
Products.PortalTransforms.interfaces
import
ITransform
from
zope.interface
import
implementer
from
zope.interface
import
implementer
from
erp5.component.document.Document
import
DocumentConversionServerProxy
,
ConversionError
,
enc
,
dec
from
erp5.component.document.Document
import
DocumentConversionServerProxy
,
ConversionError
,
enc
,
dec
from
Products.ERP5Type.Utils
import
bytes2str
,
str2bytes
@
implementer
(
ITransform
)
@
implementer
(
ITransform
)
class
DocumentConversionServerTransform
:
class
DocumentConversionServerTransform
:
"""
"""
...
@@ -51,13 +52,13 @@ class DocumentConversionServerTransform:
...
@@ -51,13 +52,13 @@ class DocumentConversionServerTransform:
source_format
=
self
.
_getFormatFromMimetype
(
source_mimetype
)
source_format
=
self
.
_getFormatFromMimetype
(
source_mimetype
)
destination_format
=
self
.
_getFormatFromMimetype
(
self
.
output
)
destination_format
=
self
.
_getFormatFromMimetype
(
self
.
output
)
data
.
setData
(
dec
(
server_proxy
.
convertFile
(
data
.
setData
(
dec
(
s
tr2bytes
(
s
erver_proxy
.
convertFile
(
enc
(
orig
),
bytes2str
(
enc
(
orig
)
),
source_format
,
source_format
,
destination_format
,
destination_format
,
# Default values are ConversionServer default ones
# Default values are ConversionServer default ones
kwargs
.
get
(
'zip'
,
False
),
kwargs
.
get
(
'zip'
,
False
),
kwargs
.
get
(
'refresh'
,
False
),
kwargs
.
get
(
'refresh'
,
False
),
kwargs
.
get
(
'conversion_kw'
,
{}))))
kwargs
.
get
(
'conversion_kw'
,
{}))))
)
return
data
return
data
\ No newline at end of file
bt5/erp5_corporate_identity/ExtensionTemplateItem/portal_components/extension.erp5.TemplateDocumentConversion.py
View file @
15219e6d
...
@@ -31,6 +31,7 @@
...
@@ -31,6 +31,7 @@
from
erp5.component.document.Document
import
DocumentConversionServerProxy
from
erp5.component.document.Document
import
DocumentConversionServerProxy
from
base64
import
b64encode
,
b64decode
from
base64
import
b64encode
,
b64decode
from
zExceptions
import
Unauthorized
from
zExceptions
import
Unauthorized
from
Products.ERP5Type.Utils
import
bytes2str
def
convertDocumentByConversionServer
(
def
convertDocumentByConversionServer
(
self
,
self
,
...
@@ -48,7 +49,7 @@ def convertDocumentByConversionServer(
...
@@ -48,7 +49,7 @@ def convertDocumentByConversionServer(
proxy
=
DocumentConversionServerProxy
(
self
)
proxy
=
DocumentConversionServerProxy
(
self
)
return
b64decode
(
return
b64decode
(
proxy
.
convertFile
(
proxy
.
convertFile
(
b
64encode
(
data
),
b
ytes2str
(
b64encode
(
data
)
),
source_mimetype
,
source_mimetype
,
destination_mimetype
,
destination_mimetype
,
zip
,
zip
,
...
...
bt5/erp5_web/ModuleComponentTemplateItem/portal_components/module.erp5.TransformHtmlToPdf.py
View file @
15219e6d
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
import
six
from
Products.PortalTransforms.interfaces
import
ITransform
from
Products.PortalTransforms.interfaces
import
ITransform
from
Products.ERP5Type.Utils
import
str2bytes
from
zope.interface
import
implementer
from
zope.interface
import
implementer
from
erp5.component.module.TransformLib
import
DocumentConversionServerTransform
from
erp5.component.module.TransformLib
import
DocumentConversionServerTransform
@
implementer
(
ITransform
)
@
implementer
(
ITransform
)
...
@@ -19,11 +21,13 @@ class TransformHtmlToPdf(DocumentConversionServerTransform):
...
@@ -19,11 +21,13 @@ class TransformHtmlToPdf(DocumentConversionServerTransform):
# (https://lab.nexedi.com/nexedi/cloudooo/merge_requests/20)
# (https://lab.nexedi.com/nexedi/cloudooo/merge_requests/20)
return
'html'
if
mimetype
==
'text/html'
else
'pdf'
return
'html'
if
mimetype
==
'text/html'
else
'pdf'
def
convert
(
self
,
*
args
,
**
kwargs
):
def
convert
(
self
,
orig
,
*
args
,
**
kwargs
):
# wkhtmltopdf handler currently requires conversion_kw (hack in convertFile())...
# wkhtmltopdf handler currently requires conversion_kw (hack in convertFile())...
if
'conversion_kw'
not
in
kwargs
:
if
'conversion_kw'
not
in
kwargs
:
kwargs
[
'conversion_kw'
]
=
{
'encoding'
:
'utf-8'
}
kwargs
[
'conversion_kw'
]
=
{
'encoding'
:
'utf-8'
}
return
DocumentConversionServerTransform
.
convert
(
self
,
*
args
,
**
kwargs
)
if
six
.
PY3
and
isinstance
(
orig
,
str
):
orig
=
str2bytes
(
orig
)
return
DocumentConversionServerTransform
.
convert
(
self
,
orig
,
*
args
,
**
kwargs
)
def
register
():
def
register
():
return
TransformHtmlToPdf
()
return
TransformHtmlToPdf
()
\ No newline at end of file
product/ERP5/bootstrap/erp5_core/MixinTemplateItem/portal_components/mixin.erp5.MailMessageMixin.py
View file @
15219e6d
...
@@ -218,6 +218,8 @@ class MailMessageMixin:
...
@@ -218,6 +218,8 @@ class MailMessageMixin:
encoding
=
part_encoding
,
encoding
=
part_encoding
,
index
=
index
)
# add index to generate
index
=
index
)
# add index to generate
# a unique cache key per attachment
# a unique cache key per attachment
if
six
.
PY3
:
content
=
str2bytes
(
content
)
else
:
else
:
content
=
part
.
get_payload
(
decode
=
1
)
content
=
part
.
get_payload
(
decode
=
1
)
return
content
return
content
...
...
product/ERP5OOo/transforms/oood_commandtransform.py
View file @
15219e6d
...
@@ -228,11 +228,11 @@ class OOOdCommandTransform(commandtransform):
...
@@ -228,11 +228,11 @@ class OOOdCommandTransform(commandtransform):
response_code
,
response_dict
,
message
=
server_proxy
.
run_generate
(
response_code
,
response_dict
,
message
=
server_proxy
.
run_generate
(
''
,
''
,
enc
(
self
.
data
),
enc
(
self
.
data
)
.
decode
()
,
None
,
None
,
format
,
format
,
self
.
mimetype
)
self
.
mimetype
)
data
=
dec
(
response_dict
[
'data'
])
data
=
dec
(
response_dict
[
'data'
]
.
encode
()
)
if
self
.
mimetype
==
'text/html'
:
if
self
.
mimetype
==
'text/html'
:
data
=
self
.
includeImageList
(
data
)
data
=
self
.
includeImageList
(
data
)
return
data
return
data
...
...
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