Commit 4fa8bca4 authored by Bram Schoenmakers's avatar Bram Schoenmakers

Rename method to set_source_text.

There's a difference between 'text' and 'source text', where the former
is a more user-friendly representation of a todo, while the source text
is the raw text from the todo.txt file.

Reflect this difference in the method name to avoid confusion with the
'text' method.
parent ba9b68e5
......@@ -23,7 +23,7 @@ class TodoBase(object):
self.src = ""
self.fields = {}
self.set_text(p_src)
self.set_source_text(p_src)
def tag_value(self, p_key, p_default=None):
"""
......@@ -139,7 +139,7 @@ class TodoBase(object):
"""
return self.text(True)
def set_text(self, p_text):
def set_source_text(self, p_text):
""" Sets the todo source text. The text will be parsed again. """
self.src = p_text.strip()
self.fields = TodoParser.parse_line(self.src)
......
......@@ -136,7 +136,7 @@ class TodoList(object):
if todo:
new_text = todo.source() + ' ' + p_string
todo.set_text(new_text)
todo.set_source_text(new_text)
def projects(self):
""" Returns a set of all projects in this list. """
......
......@@ -235,11 +235,11 @@ class TodoBaseTester(unittest.TestCase):
self.assertEquals(todo.src, "x 2014-06-13 Foo")
def test_set_text(self):
def test_set_source_text(self):
todo = TodoBase.TodoBase("(B) Foo")
new_text = "(C) Foo"
todo.set_text(new_text)
todo.set_source_text(new_text)
self.assertEquals(todo.src, new_text)
self.assertEquals(todo.priority(),'C')
......
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