Commit 6ac69f6a authored by Jean-Paul Smets's avatar Jean-Paul Smets

removed old code (with if:0 )


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@1187 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 028c3fdb
...@@ -90,52 +90,19 @@ class SelectionTool( UniqueObject, SimpleItem ): ...@@ -90,52 +90,19 @@ class SelectionTool( UniqueObject, SimpleItem ):
""" """
Returns the selection instance for a given selection_name Returns the selection instance for a given selection_name
""" """
if not REQUEST: if not REQUEST:
REQUEST = get_request() REQUEST = get_request()
# New system: store directly - bypass session
if 0: if not hasattr(self, 'selection_data'):
user_id = self.portal_membership.getAuthenticatedMember().getUserName() self.selection_data = PersistentMapping()
if user_id is not None: user_id = self.portal_membership.getAuthenticatedMember().getUserName()
return self.selection_data.get((user_id, selection_name), None) if user_id is not None:
else: if not self.selection_data.has_key(user_id):
return None self.selection_data[user_id] = PersistentMapping()
return self.selection_data[user_id].get(selection_name, None)
# Another method: local dict else:
if 0:
if not hasattr(self, 'selection_data'):
self.selection_data = PersistentMapping()
user_id = self.portal_membership.getAuthenticatedMember().getUserName()
if user_id is not None:
return self.selection_data.get((user_id, selection_name), None)
else:
return None
# Another method: local dict of dict
if 1:
if not hasattr(self, 'selection_data'):
self.selection_data = PersistentMapping()
user_id = self.portal_membership.getAuthenticatedMember().getUserName()
if user_id is not None:
if not self.selection_data.has_key(user_id):
self.selection_data[user_id] = PersistentMapping()
return self.selection_data[user_id].get(selection_name, None)
else:
return None
# Previous method
try:
session = REQUEST.SESSION
selection_name = selection_name + '_selection_object'
if session.has_key(selection_name):
return session[selection_name]
else:
return None
except:
# This prevents some transience errors to happen
return None return None
security.declareProtected(ERP5Permissions.View, 'setSelectionFor') security.declareProtected(ERP5Permissions.View, 'setSelectionFor')
def setSelectionFor(self, selection_name, selection_object, REQUEST=None): def setSelectionFor(self, selection_name, selection_object, REQUEST=None):
""" """
......
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