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
7ee02199
Commit
7ee02199
authored
May 20, 2024
by
Jérome Perrin
Committed by
Arnaud Fontaine
Jul 15, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dms: fix Image and PDF to text,html with cache
parent
6ad6fe70
Changes
2
Show 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 @
7ee02199
...
...
@@ -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 @
7ee02199
...
...
@@ -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