def remove_subtopic(self, topic): """Removes the given subtopic of the current topic. After removal the remove_subtopics observers will be called. If the subtopic is not present, then a MissingTopicError is raised. """ try: index = self.subtopics.index(topic) del self.subtopics[index] sqlite.remove_item(topic) self.remove_subtopic_observers(topic) topic.apply_to_all_child_passages(singleton_verse_to_passage_entry_map.remove_passage_entry) except ValueError: raise MissingTopicError(topic)
def remove_subtopic(self, topic): """Removes the given subtopic of the current topic. After removal the remove_subtopics observers will be called. If the subtopic is not present, then a MissingTopicError is raised. """ try: index = self.subtopics.index(topic) del self.subtopics[index] sqlite.remove_item(topic) self.remove_subtopic_observers(topic) topic.apply_to_all_child_passages( singleton_verse_to_passage_entry_map.remove_passage_entry) except ValueError: raise MissingTopicError(topic)
def remove_passage(self, passage): """Removes the given passage for the current topic. After removal the remove_passage observers will be called. If the passage is not present, then a MissingPassageError is raised. """ try: index = self._natural_order_passages.index(passage) del self._natural_order_passages[index] if self._passage_order_passages is not None: index = self._passage_order_passages.index(passage) del self._passage_order_passages[index] singleton_verse_to_passage_entry_map.remove_passage_entry(passage) sqlite.remove_item(passage) self.remove_passage_observers(passage, index) except ValueError: raise MissingPassageError(passage)