Commit 16166250 authored by Jérome Perrin's avatar Jérome Perrin

base/conversion: setContentType before converting to base format

some conversion (TextDocument) depend on the content type, so it's
necessary to first update the content type before trying to convert to
base format
parent 3aaba7a1
......@@ -10,8 +10,9 @@
<key> <string>categories</string> </key>
<value>
<tuple>
<string>after_script/portal_workflow/document_conversion_interaction_workflow/script_Document_convertToBaseFormat</string>
<string>after_script/portal_workflow/document_conversion_interaction_workflow/script_Document_guessMimeType</string>
<string>after_script/portal_workflow/document_conversion_interaction_workflow/script_Document_upload</string>
<string>after_script/portal_workflow/document_conversion_interaction_workflow/script_Document_convertToBaseFormat</string>
</tuple>
</value>
</item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Interaction Workflow Interaction" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>after_script/portal_workflow/document_conversion_interaction_workflow/script_Document_guessMimeType</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>guard_expression</string> </key>
<value> <string>here/hasFilename</string> </value>
</item>
<item>
<key> <string>guard_group</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>guard_permission</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>guard_role</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>interaction_Document_file</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Interaction Workflow Interaction</string> </value>
</item>
<item>
<key> <string>portal_type_filter</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>portal_type_group_filter</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>temporary_document_disallowed</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>trigger_method_id</string> </key>
<value>
<tuple>
<string>_setFile</string>
<string>_setData</string>
</tuple>
</value>
</item>
<item>
<key> <string>trigger_once_per_transaction</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>trigger_type</string> </key>
<value> <int>2</int> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -2,7 +2,7 @@ document = state_change['object']
portal = document.getPortalObject()
filename = document.getFilename()
content_type = portal.mimetypes_registry.lookupExtension(filename)
if content_type is not None:
if filename:
content_type = portal.mimetypes_registry.lookupExtension(filename)
if content_type is not None:
document.setContentType(str(content_type))
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment