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
Léo-Paul Géneau
erp5
Commits
4e36a8fd
Commit
4e36a8fd
authored
May 20, 2024
by
Jérome Perrin
Committed by
Arnaud Fontaine
Oct 15, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dms: Fix Image and PDF to text,html with cache (
nexedi/erp5!1751
).
parent
879e136d
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 @
4e36a8fd
...
...
@@ -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
)
...
...
bt5/erp5_dms/DocumentTemplateItem/portal_components/document.erp5.PDFDocument.py
View file @
4e36a8fd
...
...
@@ -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
()
...
...
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