From 6045358b26499c3feb9fb66405a316a2297aec87 Mon Sep 17 00:00:00 2001
From: Nicolas Delaby <nicolas@nexedi.com>
Date: Tue, 2 Mar 2010 12:10:04 +0000
Subject: [PATCH] Use portal_actions to get the filtered list of actions.
 enhance performance by using cacheable result

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@33274 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../DataProtectionRequestUtils.py                  | 14 ++++----------
 bt5/erp5_data_protection/bt/revision               |  2 +-
 2 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/bt5/erp5_data_protection/ExtensionTemplateItem/DataProtectionRequestUtils.py b/bt5/erp5_data_protection/ExtensionTemplateItem/DataProtectionRequestUtils.py
index 137f021fd3..f1b550c8aa 100644
--- a/bt5/erp5_data_protection/ExtensionTemplateItem/DataProtectionRequestUtils.py
+++ b/bt5/erp5_data_protection/ExtensionTemplateItem/DataProtectionRequestUtils.py
@@ -27,7 +27,6 @@
 #
 ##############################################################################
 
-from Products.ERP5Type.Utils import createExpressionContext
 from Products.ERP5Form.FormBox import FormBox
 from urlparse import urlparse
 
@@ -52,15 +51,10 @@ def Base_updatePropertyMapListWithFieldLabel(self, property_map_list):
         return label
   portal = self.getPortalObject()
   result_list = []
-  portal_type = self.getPortalType()
-  portal_type_object = portal.portal_types[portal_type]
-  action_view_url_list = [action.getAction() for action in \
-                                portal_type_object.getActionInformationList() \
-                                if 'view' in action.getActionType()]
-  action_url_list = [action_view_url(createExpressionContext(self))\
-                                   for action_view_url in action_view_url_list]
-  form_id_list = [urlparse(action_url)[2].split('/')[-1] \
-                                             for action_url in action_url_list]
+  action_list_dict = portal.portal_actions.listFilteredActionsFor(self)
+  action_list = action_list_dict.get('object_view', ())
+  form_id_list = [urlparse(action['url'])[2].split('/')[-1] \
+                                             for action in action_list]
   for property_map in property_map_list:
     label = None
     for form_id in form_id_list:
diff --git a/bt5/erp5_data_protection/bt/revision b/bt5/erp5_data_protection/bt/revision
index 3cacc0b93c..3f10ffe7a4 100644
--- a/bt5/erp5_data_protection/bt/revision
+++ b/bt5/erp5_data_protection/bt/revision
@@ -1 +1 @@
-12
\ No newline at end of file
+15
\ No newline at end of file
-- 
2.30.9