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
b6f3cb06
Commit
b6f3cb06
authored
Jun 02, 2016
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BT: prefer .jpg for image/jpeg, and .bin for application/octet-stream
parent
3ae828d6
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
7 deletions
+26
-7
product/ERP5/bootstrap/erp5_core/ToolTemplateItem/mimetypes_registry.xml
...otstrap/erp5_core/ToolTemplateItem/mimetypes_registry.xml
+2
-2
product/ERP5/tests/testBusinessTemplateTwoFileExport.py
product/ERP5/tests/testBusinessTemplateTwoFileExport.py
+4
-4
product/ERP5OOo/tests/testDms.py
product/ERP5OOo/tests/testDms.py
+1
-1
product/ERP5Type/ZopePatch.py
product/ERP5Type/ZopePatch.py
+1
-0
product/ERP5Type/patches/MimetypesRegistry.py
product/ERP5Type/patches/MimetypesRegistry.py
+18
-0
No files found.
product/ERP5/bootstrap/erp5_core/ToolTemplateItem/mimetypes_registry.xml
View file @
b6f3cb06
...
...
@@ -11011,9 +11011,9 @@
<key> <string>extensions</string> </key>
<value>
<tuple>
<string>bin</string>
<string>obj</string>
<string>so</string>
<string>bin</string>
<string>a</string>
</tuple>
</value>
...
...
@@ -17635,9 +17635,9 @@
<key> <string>extensions</string> </key>
<value>
<tuple>
<string>jpg</string>
<string>pjpg</string>
<string>jpeg</string>
<string>jpg</string>
<string>jpe</string>
</tuple>
</value>
product/ERP5/tests/testBusinessTemplateTwoFileExport.py
View file @
b6f3cb06
...
...
@@ -286,7 +286,7 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
def
test_twoFileImportExportForImageIdentifyingTypeByContentType
(
self
):
"""
Test Business Template Import And Export With Image In Image Module
where extension (.
p
jpg) is found by content_type
where extension (.jpg) is found by content_type
"""
image_data
=
"""MalformedBase64HereiVBORw0KGgoAAAANSUhEUgAAAAUA
AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
...
...
@@ -297,7 +297,7 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
data
=
image_data
,
content_type
=
"image/jpeg"
,
portal_type
=
"Image"
,
),
'.
p
jpg'
)
),
'.jpg'
)
def
test_twoFileImportExportForImageNotIdentifyingType
(
self
):
"""
...
...
@@ -356,14 +356,14 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
def
test_twoFileImportExportForFileIdentifyingTypeByContentTypeObj
(
self
):
"""
Test Business Template Import And Export With File
where extension (.
obj
) is identified by the content_type
where extension (.
bin
) is identified by the content_type
"""
self
.
_checkTwoFileImportExportForDocumentInDocumentModule
(
dict
(
title
=
"foo"
,
data
=
"a test file"
,
content_type
=
"application/octet-stream"
,
portal_type
=
"File"
,
),
'.
obj
'
)
),
'.
bin
'
)
def
test_twoFileImportExportForFileIdentifyingTypeByContentTypeEpub
(
self
):
"""
...
...
product/ERP5OOo/tests/testDms.py
View file @
b6f3cb06
...
...
@@ -1612,7 +1612,7 @@ class TestDocument(TestDocumentMixin):
image_count
=
builder
.
_image_count
failure_message
=
'Expected image not found in ODF zipped archive'
# fetch image from zipped archive content then compare with ERP5 Image
self
.
assertEqual
(
builder
.
extract
(
'Pictures/%s.
p
jpg'
%
image_count
),
self
.
assertEqual
(
builder
.
extract
(
'Pictures/%s.jpg'
%
image_count
),
image
.
getData
(),
failure_message
)
# Continue the test with image resizing support
...
...
product/ERP5Type/ZopePatch.py
View file @
b6f3cb06
...
...
@@ -86,6 +86,7 @@ from Products.ERP5Type.patches import DTMLDocument
from
Products.ERP5Type.patches
import
CMFCoreUtils
from
Products.ERP5Type.patches
import
ZopePageTemplate
from
Products.ERP5Type.patches
import
ZSQLMethod
from
Products.ERP5Type.patches
import
MimetypesRegistry
# These symbols are required for backward compatibility
from
Products.ERP5Type.patches.PropertyManager
import
ERP5PropertyManager
...
...
product/ERP5Type/patches/MimetypesRegistry.py
0 → 100644
View file @
b6f3cb06
from
Products.MimetypesRegistry
import
MimeTypesRegistry
,
mime_types
preferred_extension_dict
=
{
"bin"
:
"application/octet-stream"
,
"jpg"
:
"image/jpeg"
,
}
def
initialize
(
registry
):
mime_types
.
initialize
(
registry
)
for
ext
,
mime
in
preferred_extension_dict
.
iteritems
():
mime
,
=
registry
.
lookup
(
mime
)
assert
type
(
mime
.
extensions
)
is
tuple
x
=
list
(
mime
.
extensions
)
x
.
remove
(
ext
)
x
.
insert
(
0
,
ext
)
mime
.
extensions
=
tuple
(
x
)
MimeTypesRegistry
.
initialize
=
initialize
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