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
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
Jérome Perrin
erp5
Commits
29bb5db4
Commit
29bb5db4
authored
9 months ago
by
Jérome Perrin
Committed by
Arnaud Fontaine
5 months ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dms: fix Image and PDF to text,html with cache
parent
5e80d414
1 merge request
!17
WIP: Zope4py3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
4 deletions
+7
-4
bt5/erp5_base/DocumentTemplateItem/portal_components/document.erp5.Image.py
...mentTemplateItem/portal_components/document.erp5.Image.py
+3
-2
bt5/erp5_dms/DocumentTemplateItem/portal_components/document.erp5.PDFDocument.py
...mplateItem/portal_components/document.erp5.PDFDocument.py
+4
-2
No files found.
bt5/erp5_base/DocumentTemplateItem/portal_components/document.erp5.Image.py
View file @
29bb5db4
...
...
@@ -38,7 +38,7 @@ from Acquisition import aq_base
import
Products.ERP5
from
Products.ERP5Type
import
Permissions
,
PropertySheet
from
Products.ERP5Type.Utils
import
fill_args_from_request
from
Products.ERP5Type.Utils
import
bytes2str
,
fill_args_from_request
from
erp5.component.document.File
import
File
from
erp5.component.document.Document
import
Document
,
ConversionError
,
\
VALID_TEXT_FORMAT_LIST
,
VALID_TRANSPARENT_IMAGE_FORMAT_LIST
,
\
...
...
@@ -280,7 +280,8 @@ class Image(TextConvertableMixin, File, OFSImage):
if
format
in
VALID_TEXT_FORMAT_LIST
:
try
:
return
self
.
getConversion
(
format
=
format
)
mime
,
data
=
self
.
getConversion
(
format
=
format
)
return
mime
,
bytes2str
(
data
)
except
KeyError
:
mime_type
,
data
=
self
.
_convertToText
(
format
)
data
=
aq_base
(
data
)
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_dms/DocumentTemplateItem/portal_components/document.erp5.PDFDocument.py
View file @
29bb5db4
...
...
@@ -123,7 +123,8 @@ class PDFDocument(Image):
"""
if
format
==
'html'
:
try
:
return
self
.
getConversion
(
format
=
format
)
mime
,
data
=
self
.
getConversion
(
format
=
format
)
return
mime
,
bytes2str
(
data
)
except
KeyError
:
mime
=
'text/html'
data
=
self
.
_convertToHTML
()
...
...
@@ -131,7 +132,8 @@ class PDFDocument(Image):
return
(
mime
,
data
)
elif
format
in
(
'txt'
,
'text'
):
try
:
return
self
.
getConversion
(
format
=
'txt'
)
mime
,
data
=
self
.
getConversion
(
format
=
'txt'
)
return
mime
,
bytes2str
(
data
)
except
KeyError
:
mime
=
'text/plain'
data
=
self
.
_convertToText
()
...
...
This diff is collapsed.
Click to expand it.
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