From 5e0eaf08613c9844f0b1fade78a86c8a7d751038 Mon Sep 17 00:00:00 2001
From: Kazuhiko Shiozaki <kazuhiko@nexedi.com>
Date: Tue, 16 Jun 2009 11:36:08 +0000
Subject: [PATCH] calling getStorageItemList() in getStorage() is bad for
 performance.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@27599 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5Form/SelectionTool.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/product/ERP5Form/SelectionTool.py b/product/ERP5Form/SelectionTool.py
index 6e96de7688..0fb4889087 100644
--- a/product/ERP5Form/SelectionTool.py
+++ b/product/ERP5Form/SelectionTool.py
@@ -139,13 +139,11 @@ class SelectionTool( BaseTool, UniqueObject, SimpleItem ):
         RESPONSE.redirect('%s/manage_configure' % (self.absolute_url()))
 
     security.declareProtected( ERP5Permissions.ManagePortal, 'getStorage')
-    def getStorage(self, default=None):
+    def getStorage(self, default='selection_data'):
       """return the selected storage
       """
-      if default is None:
-        default = self.getStorageItemList()[0][1]
       storage = getattr(aq_base(self), 'storage', default)
-      if storage is not default and storage not in [item[1] for item in self.getStorageItemList()]:
+      if storage is not default:
         #Backward compatibility
         if storage == 'Persistent Mapping':
           storage = 'selection_data'
-- 
2.30.9