From fe41e41c461ad0d0f593b885f68e1da7f37ad8a6 Mon Sep 17 00:00:00 2001
From: Yoshinori Okuji <yo@nexedi.com>
Date: Fri, 28 Oct 2005 09:05:12 +0000
Subject: [PATCH] portal_workflow was not always obtained.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4154 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5Type/CopySupport.py | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/product/ERP5Type/CopySupport.py b/product/ERP5Type/CopySupport.py
index 0888e04524..2d81509cc6 100755
--- a/product/ERP5Type/CopySupport.py
+++ b/product/ERP5Type/CopySupport.py
@@ -196,21 +196,22 @@ class CopyContainer:
     # Add info about copy to edit workflow
     REQUEST = get_request()
     if REQUEST is not None and REQUEST.get('__cp', None) :
-      pw = self.restrictedTraverse("portal_workflow")
+      pw = getToolByName(self, 'portal_workflow')
       copied_item_list = _cb_decode(REQUEST['__cp'])[1]
       # Guess source item
       for c_item in copied_item_list:
         if c_item[-1] in item.getId():
           source_item = '/'.join(c_item)
           break
-      else :
+      else:
         source_item = '/'.join(copied_item_list[0])
-      try :
+      try:
         pw.doActionFor(self_base, 'edit_action', wf_id='edit_workflow', comment='Object copied from %s' % source_item)
       except WorkflowException:
         pass
-    else :
-      try :
+    else:
+      pw = getToolByName(self, 'portal_workflow')
+      try:
         pw.doActionFor(self_base, 'edit_action', wf_id='edit_workflow', comment='Object copied as %s' % item.getId())
       except WorkflowException:
         pass
-- 
2.30.9