Commit 378b2d17 authored by Tristan Cavelier's avatar Tristan Cavelier

erp5_dms_conversion_catalog: add WebIllustration_preConvert and improve Image_preConvert

parent 94f6da21
......@@ -50,7 +50,9 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>"""\n
<value> <string encoding="cdata"><![CDATA[
"""\n
Do actual conversion of any Image type.\n
"""\n
if quality is None:\n
......@@ -58,10 +60,19 @@ if quality is None:\n
# directly accessed over URL will do the same\n
quality = context.getDefaultImageQuality(format)\n
\n
if not context.getContentType("").startswith(\'image/\'):\n
context.log(\'Image_preConvert\', \'%s is not an image, skipping preconversion\' % context.getRelativeUrl())\n
return \n
\n
# UI uses \'large\' display\n
display_list.append(\'large\')\n
# Usually links in web page contain image as <img src="url?format=png"> without display\n
display_list.append(None)\n
\n
context.Base_preConvert(format, quality, display_list)\n
</string> </value>
]]></string> </value>
</item>
<item>
<key> <string>_params</string> </key>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[
"""\n
Do actual conversion of Web Page. As it involves cloudoo use serialization tag and activity.\n
"""\n
portal = context.getPortalObject()\n
\n
format_kw = {\'format\': format,\n
\'quality\': quality}\n
for display in display_list:\n
format_kw[\'display\'] = display\n
context.activate(serialization_tag=\'pre_convert\').convert(**format_kw)\n
\n
# try to convert all relative referenced (i.e. by <img> tag) documents\n
context.activate().WebPage_preConvertReferencedImageList(**format_kw)\n
]]></string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>format, quality, display_list</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>WebIllustration_preConvert</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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