From 6ac69f6ab9d853b10ccfe06e258113e9fc236f43 Mon Sep 17 00:00:00 2001 From: Jean-Paul Smets <jp@nexedi.com> Date: Tue, 13 Jul 2004 10:42:38 +0000 Subject: [PATCH] removed old code (with if:0 ) git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@1187 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5Form/SelectionTool.py | 53 ++++++------------------------- 1 file changed, 10 insertions(+), 43 deletions(-) diff --git a/product/ERP5Form/SelectionTool.py b/product/ERP5Form/SelectionTool.py index 24ee7f2f62..d34cde9450 100755 --- a/product/ERP5Form/SelectionTool.py +++ b/product/ERP5Form/SelectionTool.py @@ -90,52 +90,19 @@ class SelectionTool( UniqueObject, SimpleItem ): """ Returns the selection instance for a given selection_name """ - - if not REQUEST: REQUEST = get_request() - # New system: store directly - bypass session - if 0: - 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 - 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 + + 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 - + security.declareProtected(ERP5Permissions.View, 'setSelectionFor') def setSelectionFor(self, selection_name, selection_object, REQUEST=None): """ -- 2.30.9