Commit 4936565d authored by Jacek Sowiński's avatar Jacek Sowiński

Add "replace" method for TodoList objects

This will be used to recreate TodoList from a list of Todo objects.
parent 95861af2
......@@ -173,6 +173,12 @@ class TodoListBase(object):
self._todos = []
self.dirty = True
def replace(self, p_todos):
""" Replaces whole todolist with todo objects supplied as p_todos. """
self.erase()
self.add_todos(p_todos)
self.dirty = True
def count(self):
""" Returns the number of todos on this list. """
return len(self._todos)
......
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