def removeViewItem(self,endpoint): """ Remove view item from session data - NB, do this by rebuilding the session data without the input data included @param endpoint: The WMC endpoint of the view item to remove """ selections = [] for selection in session['viewItems']: if selection.wmcURL != endpoint: selections.append(selection) # if the new list is empty, remove the session variable if len(selections) == 0: del session['viewItems'] c.UpdatePageTabs=1 else: session['viewItems'] = selections session.save()
def addViewItem(self,endpoint): """ Add a selected item to the session - if this is the first item, then display the selections tab @param endpoint: WMC endpoint """ item = selectedItem.SelectedItem(None, None, None, endpoint) selections = [item,] # avoid duplicates if 'viewItems' in session: for selection in session['viewItems']: if selection.wmcURL != endpoint: selections.append(selection) session['viewItems'] = selections session.save()
def removeAllViewItems(self): """ Remove all old view items - clears out old endpoints """ session['viewItems']=[] session.save()