def get_tx_selectionmethod_actions(db, selection): """Return list of selectionmethod transactions for an extent.""" cls = commontype(selection) if cls is None: return [] else: if getattr(cls, '_hidden_t_selectionmethods', None) is not None: hidden = cls._hidden_t_selectionmethods(selection) or [] else: hidden = [] actions = [] for method_name in sorted(cls.t): if method_name not in hidden: action = get_method_action(db, cls, 't', method_name) action.selection = selection actions.append(action) return sorted(actions)
def select_delete_action(self): selection = self.get_selected() if isinstance(selection, list): if len(selection) == 1: selection = selection[0] # Pass through to 'if selection is not None' block # below. else: cls = commontype(selection) if cls is None: return method_name = 'delete_selected' if method_name in cls.t: m_action = get_method_action( self._db, cls, 't', method_name) m_action.selection = selection self.select_action(m_action) return if selection is not None: method_name = 'delete' if method_name in selection.t: m_action = get_method_action( self._db, selection, 't', method_name) self.select_action(m_action)