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

content_translation: introspect portal types to catalog all content translation properties

It's no longer needed to configure using the script
parent d9f1bb4e
......@@ -51,15 +51,8 @@
<item>
<key> <string>_body</string> </key>
<value> <string>from Products.ERP5Type.Utils import convertToUpperCase\n
\n
\n
########### CONFIGURATION ######################################\n
# If you want to index properties more, extend property_list #\n
# and portal_type_list. #\n
################################################################\n
property_list = (\'title\',)\n
portal_type_list = (\'Person\',)\n
\n
portal = context.getPortalObject()\n
portal_type_property_mapping = portal.ERP5Site_getPortalTypeContentTranslationMapping()\n
\n
result = []\n
\n
......@@ -69,10 +62,12 @@ def upperCase(text):\n
content_language_list = context.Localizer.get_languages()\n
\n
for document in document_list:\n
if document.getPortalType() not in portal_type_list:\n
portal_type = document.getPortalType()\n
if portal_type not in portal_type_property_mapping:\n
continue\n
\n
uid = document.getUid()\n
for property_name in property_list:\n
for property_name in portal_type_property_mapping[portal_type]:\n
temporary_result = []\n
\n
original_text = None\n
......
<?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>_Cacheable__manager_id</string> </key>
<value>
<none/>
</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>from Products.ERP5Type.Cache import CachingMethod\n
\n
def getPortalTypeContentTranslationMapping():\n
result = dict()\n
for type_information in context.getPortalObject().portal_types.listTypeInfo():\n
content_translation_domain_property_name_list =\\\n
type_information.getContentTranslationDomainPropertyNameList()\n
if content_translation_domain_property_name_list:\n
result[type_information.getId()] = content_translation_domain_property_name_list\n
return result \n
\n
getPortalTypeContentTranslationMapping = CachingMethod(\n
getPortalTypeContentTranslationMapping,\n
id=script.id, \n
cache_factory=\'erp5_content_long\')\n
return getPortalTypeContentTranslationMapping()\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_getPortalTypeContentTranslationMapping</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
44
\ No newline at end of file
45
\ No newline at end of file
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