Commit f723cf24 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 d779b1f4
......@@ -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>
......
......@@ -22,7 +22,7 @@
</item>
<item>
<key> <string>guard_expression</string> </key>
<value> <string>here/hasFilename</string> </value>
<value> <string>not: here/isSupportBaseDataConversion</string> </value>
</item>
<item>
<key> <string>guard_group</string> </key>
......
......@@ -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:
document.setContentType(str(content_type))
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