def _replace(self, idx, line): """Replace the task given by its idx by the new line.""" # Frist, we need to find the task task = self.todo.find('id', idx) if task: i = self.todo.index(task) task = Task() # create a new task # Parse input line for GTD and additional attributes task.add(**self._parse_line(line)) task.add(id=idx) # And, replace it into the to-do list self.todo[i] = task
def _add(self, line): """Adds task from the given line and returns the new task_id.""" if line: # Create the new task task = Task() # Parse input line for GTD and additional attributes task.add(**self._parse_line(line)) # And, add it to the to-do list task_id = self.todo.add(task) # And, set the start date if none self.do_append("%d S:%s" % (task_id, datetime.datetime.now().strftime("%Y-%m-%d"))) return task_id
def _replace(self, idx, line): """Replace the task given by its idx by the new line.""" # Frist, we need to find the task task = self.todo.find('id', idx) if task: i = self.todo.index(task) task = Task() # create a new task # Parse input line for GTD and additional attributes task.add(**self._parse_line(line)) task.add(id=idx) # And, replace it into the to-do list self.todo[i] = task # And, set the start date if none self.do_append("%d S:%s" % (idx, datetime.datetime.now().strftime("%Y-%m-%d")))