Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
erp5_rtl_support
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Romain Courteaud
erp5_rtl_support
Commits
34f77c3b
Commit
34f77c3b
authored
Jun 03, 2016
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BT: avoid acquisition when guessing extension
parent
18958665
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
8 deletions
+9
-8
product/ERP5/Document/BusinessTemplate.py
product/ERP5/Document/BusinessTemplate.py
+9
-8
No files found.
product/ERP5/Document/BusinessTemplate.py
View file @
34f77c3b
...
...
@@ -755,14 +755,14 @@ class ObjectTemplateItem(BaseTemplateItem):
def
_guessFilename
(
self
,
document
,
key
,
exported_property_type
):
# Try to guess the extension based on the id of the document
yield
key
document_base
=
aq_base
(
document
)
# Try to guess the extension based on the reference of the document
if
hasattr
(
document
,
'getReference'
):
if
hasattr
(
document
_base
,
'getReference'
):
yield
document
.
getReference
()
elif
isinstance
(
document
,
ERP5BaseBroken
):
yield
getattr
(
document
,
"reference"
,
None
)
elif
isinstance
(
document
_base
,
ERP5BaseBroken
):
yield
getattr
(
document
_base
,
"reference"
,
None
)
# Try to guess the extension based on the title of the document
yield
getattr
(
document
,
"title"
,
None
)
# Try to get type of image from its base64 encoding
yield
getattr
(
document_base
,
"title"
,
None
)
if
exported_property_type
==
'data'
:
# XXX maybe decoding the whole file just for the extension is an overkill
data
=
str
(
document
.
__dict__
.
get
(
'data'
))
...
...
@@ -791,12 +791,13 @@ class ObjectTemplateItem(BaseTemplateItem):
- '.bin' is returned for binary files
- '.txt' is returned for text
"""
document_base
=
aq_base
(
document
)
# XXX Zope items like DTMLMethod would not implement getContentType method
mime
=
None
if
hasattr
(
document
,
'getContentType'
):
if
hasattr
(
document
_base
,
'getContentType'
):
content_type
=
document
.
getContentType
()
elif
isinstance
(
document
,
ERP5BaseBroken
):
content_type
=
getattr
(
document
,
"content_type"
,
None
)
elif
isinstance
(
document
_base
,
ERP5BaseBroken
):
content_type
=
getattr
(
document
_base
,
"content_type"
,
None
)
else
:
content_type
=
None
# For stable export, people must have a MimeTypes Registry, so do not
...
...
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