Commit ada47bc3 authored by Bram Schoenmakers's avatar Bram Schoenmakers

Return instance of todo that has been added.

Returns None when no todo item was added.
parent 814b3179
...@@ -94,6 +94,7 @@ class TodoList(object): ...@@ -94,6 +94,7 @@ class TodoList(object):
Then there will be an edge 1 --> 2 with ID 4. Then there will be an edge 1 --> 2 with ID 4.
""" """
todo = None
if re.search(r'\S', p_src): if re.search(r'\S', p_src):
number = len(self._todos) + 1 number = len(self._todos) + 1
todo = Todo.Todo(p_src, number) todo = Todo.Todo(p_src, number)
...@@ -101,6 +102,8 @@ class TodoList(object): ...@@ -101,6 +102,8 @@ class TodoList(object):
self._maintain_dep_graph(todo) self._maintain_dep_graph(todo)
return todo
def delete(self, p_number): def delete(self, p_number):
""" Deletes a todo item from the list. """ """ Deletes a todo item from the list. """
todo = self.todo(p_number) todo = self.todo(p_number)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment