Commit 188fe5c9 authored by Jérome Perrin's avatar Jérome Perrin

store instances of Message in workflow history, not translated strings

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@40229 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 679ea557
...@@ -2,10 +2,7 @@ ...@@ -2,10 +2,7 @@
<ZopeData> <ZopeData>
<record id="1" aka="AAAAAAAAAAE="> <record id="1" aka="AAAAAAAAAAE=">
<pickle> <pickle>
<tuple>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/> <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<tuple/>
</tuple>
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
...@@ -53,8 +50,8 @@ ...@@ -53,8 +50,8 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>Base_translateString = context.Base_translateString\n <value> <string>from Products.ERP5Type.Message import translateString\n
language_column_list = [(i[\'id\'], Base_translateString(i[\'title\']))\n language_column_list = [(i[\'id\'], translateString(i[\'title\']))\n
for i in context.Localizer.get_languages_map()]\n for i in context.Localizer.get_languages_map()]\n
language_column_list.sort()\n language_column_list.sort()\n
return language_column_list\n return language_column_list\n
...@@ -94,12 +91,13 @@ return language_column_list\n ...@@ -94,12 +91,13 @@ return language_column_list\n
<key> <string>co_varnames</string> </key> <key> <string>co_varnames</string> </key>
<value> <value>
<tuple> <tuple>
<string>_getattr_</string> <string>Products.ERP5Type.Message</string>
<string>context</string> <string>translateString</string>
<string>Base_translateString</string>
<string>append</string> <string>append</string>
<string>$append0</string> <string>$append0</string>
<string>_getiter_</string> <string>_getiter_</string>
<string>_getattr_</string>
<string>context</string>
<string>i</string> <string>i</string>
<string>_getitem_</string> <string>_getitem_</string>
<string>language_column_list</string> <string>language_column_list</string>
......
...@@ -50,20 +50,22 @@ ...@@ -50,20 +50,22 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>document = state_change_info[\'object\']\n <value> <string>from Products.ERP5Type.Message import translateString\n
document = state_change_info[\'object\']\n
portal = state_change_info.getPortal()\n portal = state_change_info.getPortal()\n
\n \n
error_message_list = []\n error_message_list = []\n
language_item_list = portal.Base_getContentTranslationLanguageValueAndLabelList()\n
\n \n
for property_name, original_message in document.Base_getContentTranslationPropertyValueAndLabelList():\n for property_name, original_message in document.Base_getContentTranslationPropertyValueAndLabelList():\n
for language, language_label in document.Base_getContentTranslationLanguageValueAndLabelList():\n for language, language_label in language_item_list:\n
try:\n try:\n
translation_original_text = document.getPropertyTranslationOriginalText(property_name, language)\n translation_original_text = document.getPropertyTranslationOriginalText(property_name, language)\n
except KeyError:\n except KeyError:\n
translation_original_text = None\n translation_original_text = None\n
if translation_original_text is not None and translation_original_text!=original_message:\n if translation_original_text is not None and translation_original_text!=original_message:\n
error_message = context.Base_translateString(\n error_message = translateString(\n
\'property ${property_name} of ${language} is outdated.\', mapping={\'property_name\':property_name, \'language\':language})\n \'property ${property_name} of ${language} is outdated\', mapping={\'property_name\':property_name, \'language\':language_label})\n
error_message_list.append(error_message)\n error_message_list.append(error_message)\n
\n \n
\n \n
...@@ -72,7 +74,7 @@ content_translation_state = portal.portal_workflow.getInfoFor(document, \'conten ...@@ -72,7 +74,7 @@ content_translation_state = portal.portal_workflow.getInfoFor(document, \'conten
\n \n
if error_message_list:\n if error_message_list:\n
if content_translation_state!=\'outdated\':\n if content_translation_state!=\'outdated\':\n
document.invalidateContentTranslation(error_message=\'\\n\'.join(map(str, error_message_list)))\n document.invalidateContentTranslation(error_message=error_message_list)\n
else:\n else:\n
if content_translation_state!=\'latest\':\n if content_translation_state!=\'latest\':\n
document.validateContentTranslation()\n document.validateContentTranslation()\n
...@@ -121,11 +123,14 @@ else:\n ...@@ -121,11 +123,14 @@ else:\n
<value> <value>
<tuple> <tuple>
<string>state_change_info</string> <string>state_change_info</string>
<string>Products.ERP5Type.Message</string>
<string>translateString</string>
<string>_getitem_</string> <string>_getitem_</string>
<string>document</string> <string>document</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>portal</string> <string>portal</string>
<string>error_message_list</string> <string>error_message_list</string>
<string>language_item_list</string>
<string>_getiter_</string> <string>_getiter_</string>
<string>property_name</string> <string>property_name</string>
<string>original_message</string> <string>original_message</string>
...@@ -134,11 +139,8 @@ else:\n ...@@ -134,11 +139,8 @@ else:\n
<string>translation_original_text</string> <string>translation_original_text</string>
<string>KeyError</string> <string>KeyError</string>
<string>None</string> <string>None</string>
<string>context</string>
<string>error_message</string> <string>error_message</string>
<string>content_translation_state</string> <string>content_translation_state</string>
<string>map</string>
<string>str</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
34 36
\ No newline at end of file \ 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