Commit 5e0eaf08 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

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
parent bfa442f2
...@@ -139,13 +139,11 @@ class SelectionTool( BaseTool, UniqueObject, SimpleItem ): ...@@ -139,13 +139,11 @@ class SelectionTool( BaseTool, UniqueObject, SimpleItem ):
RESPONSE.redirect('%s/manage_configure' % (self.absolute_url())) RESPONSE.redirect('%s/manage_configure' % (self.absolute_url()))
security.declareProtected( ERP5Permissions.ManagePortal, 'getStorage') security.declareProtected( ERP5Permissions.ManagePortal, 'getStorage')
def getStorage(self, default=None): def getStorage(self, default='selection_data'):
"""return the selected storage """return the selected storage
""" """
if default is None:
default = self.getStorageItemList()[0][1]
storage = getattr(aq_base(self), 'storage', default) 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 #Backward compatibility
if storage == 'Persistent Mapping': if storage == 'Persistent Mapping':
storage = 'selection_data' storage = 'selection_data'
......
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