From 82a791531a9c3bedfb54271bc2e16518fa19b793 Mon Sep 17 00:00:00 2001
From: Nicolas Delaby <nicolas@nexedi.com>
Date: Wed, 16 May 2007 15:43:34 +0000
Subject: [PATCH] Display message instead of IndexError when displaying
 Workflow History with missing workflow

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@14505 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../Base_getWorkflowHistoryItemList.xml          | 16 ++++++++++++----
 product/ERP5/bootstrap/erp5_core/bt/revision     |  2 +-
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_getWorkflowHistoryItemList.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_getWorkflowHistoryItemList.xml
index 5efbd0bffb..b812c44d23 100644
--- a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_getWorkflowHistoryItemList.xml
+++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_getWorkflowHistoryItemList.xml
@@ -100,17 +100,17 @@ for workflow_item in workflow_item_list:\n
     if key.endswith(\'state\'): \n
       key = \'state\'\n
       if display:\n
-        value = wf_states[value].title\n
+        value = wf_states.get(value, None) and wf_states[value].title\n
       else:\n
-        value = wf_states[value].id\n
+        value = wf_states.get(value, None) and wf_states[value].id\n
     if key == \'action\':\n
       if value != \'\' and value is not None:\n
         if value == "\'edit\'":\n
           value = "edit"\n
         if display:\n
-          value = wf_transitions[value].title or wf_transitions[value].actbox_name or value\n
+          value = wf_transitions.get(value, None) and (wf_transitions[value].title or wf_transitions[value].actbox_name) or value\n
         else:\n
-          value = wf_transitions[value].id or wf_transitions[value].actbox_name or value\n
+          value = wf_transitions.get(value, None) and (wf_transitions[value].id or wf_transitions[value].actbox_name) or value\n
     if display:\n
       if key == \'error_message\' and not same_type(value, \'\'):\n
         value = \'%s\' %value\n
@@ -118,6 +118,8 @@ for workflow_item in workflow_item_list:\n
         value = context.Localizer.erp5_ui.gettext(value)\n
       elif same_type(value, \'\') and key in ( \'action\', \'state\' ): \n
         value = context.Localizer.erp5_ui.gettext(value)\n
+    if value is None:\n
+      value = \'Does not exist\'\n
     o.setProperty(key, value)\n
  \n
   # record current serial as "next serial" for the previous revision\n
@@ -142,6 +144,12 @@ return result\n
               <none/>
             </value>
         </item>
+        <item>
+            <key> <string>_owner</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
         <item>
             <key> <string>_params</string> </key>
             <value> <string>workflow_id, display=1, **kw</string> </value>
diff --git a/product/ERP5/bootstrap/erp5_core/bt/revision b/product/ERP5/bootstrap/erp5_core/bt/revision
index 55bd0ac4c4..1713e61879 100644
--- a/product/ERP5/bootstrap/erp5_core/bt/revision
+++ b/product/ERP5/bootstrap/erp5_core/bt/revision
@@ -1 +1 @@
-333
+334
\ No newline at end of file
-- 
2.30.9