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
Mikolaï Krol
erp5
Commits
645a4ece
Commit
645a4ece
authored
Apr 17, 2012
by
Sebastien Robin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allow to upload/download Files with unknown mime type
parent
48f86374
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
10 deletions
+25
-10
product/ERP5/mixin/downloadable.py
product/ERP5/mixin/downloadable.py
+11
-10
product/ERP5OOo/tests/testDms.py
product/ERP5OOo/tests/testDms.py
+13
-0
product/ERP5OOo/tests/test_document/TEST-001-en.dummy
product/ERP5OOo/tests/test_document/TEST-001-en.dummy
+1
-0
No files found.
product/ERP5/mixin/downloadable.py
View file @
645a4ece
...
@@ -86,16 +86,17 @@ class DownloadableMixin:
...
@@ -86,16 +86,17 @@ class DownloadableMixin:
output_format
=
None
output_format
=
None
if
not
format
:
if
not
format
:
# Guess the format from original mimetype
# Guess the format from original mimetype
mimetypes_registry
=
getToolByName
(
self
.
getPortalObject
(),
if
mime
:
'mimetypes_registry'
)
mimetypes_registry
=
getToolByName
(
self
.
getPortalObject
(),
mimetype_object_list
=
mimetypes_registry
.
lookup
(
mime
)
'mimetypes_registry'
)
for
mimetype_object
in
mimetype_object_list
:
mimetype_object_list
=
mimetypes_registry
.
lookup
(
mime
)
if
mimetype_object
.
extensions
:
for
mimetype_object
in
mimetype_object_list
:
output_format
=
mimetype_object
.
extensions
[
0
]
if
mimetype_object
.
extensions
:
break
output_format
=
mimetype_object
.
extensions
[
0
]
elif
mimetype_object
.
globs
:
break
output_format
=
mimetype_object
.
globs
.
strip
(
'*.'
)
elif
mimetype_object
.
globs
:
break
output_format
=
mimetype_object
.
globs
.
strip
(
'*.'
)
break
else
:
else
:
output_format
=
format
output_format
=
format
...
...
product/ERP5OOo/tests/testDms.py
View file @
645a4ece
...
@@ -2616,6 +2616,19 @@ return 1
...
@@ -2616,6 +2616,19 @@ return 1
self
.
assertEqual
(
'archived'
,
document_nolang_005
.
getValidationState
())
self
.
assertEqual
(
'archived'
,
document_nolang_005
.
getValidationState
())
self
.
assertEqual
(
'shared_alive'
,
document_nolang_006
.
getValidationState
())
self
.
assertEqual
(
'shared_alive'
,
document_nolang_006
.
getValidationState
())
def
testFileWithNotDefinedMimeType
(
self
):
upload_file
=
makeFileUpload
(
'TEST-001-en.dummy'
)
kw
=
dict
(
file
=
upload_file
,
synchronous_metadata_discovery
=
True
,
portal_type
=
'File'
)
document
=
self
.
portal
.
Base_contribute
(
**
kw
)
document
.
setReference
(
'TEST'
)
request
=
self
.
app
.
REQUEST
download_file
=
document
.
index_html
(
REQUEST
=
request
,
format
=
None
)
self
.
assertEquals
(
download_file
,
'foo
\
n
'
)
document_format
=
None
self
.
assertEquals
(
'TEST-001-en.dummy'
,
document
.
getStandardFilename
(
document_format
))
class
TestDocumentWithSecurity
(
TestDocumentMixin
):
class
TestDocumentWithSecurity
(
TestDocumentMixin
):
username
=
'yusei'
username
=
'yusei'
...
...
product/ERP5OOo/tests/test_document/TEST-001-en.dummy
0 → 100644
View file @
645a4ece
foo
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