Commit f433fb24 authored by Bram Schoenmakers's avatar Bram Schoenmakers

Allow any tag to have a date value.

Fixes a bug that ListCommand wouldn't show items matching key:2014-12-12

Conflicts:
	test/ListCommandTest.py
parent 91fc78ba
......@@ -57,7 +57,7 @@ class ListCommandTest(CommandTest.CommandTest):
command.execute()
self.assertFalse(self.todolist.is_dirty())
self.assertEquals(self.output, " 1 (C) Foo @Context2 Not@Context +Project1 Not+Project\n 3 (C) Baz @Context1 +Project1 key:value id:1\n 4 (C) Drink beer @ home\n 5 (C) 13 + 29 = 42\n 2 (D) Bar @Context1 +Project2 p:1\n")
self.assertEquals(self.output, " 1 (C) Foo @Context2 Not@Context +Project1 Not+Project\n 3 (C) Baz @Context1 +Project1 key:value id:1\n 4 (C) Drink beer @ home\n 5 (C) 13 + 29 = 42\n 2 (D) Bar @Context1 +Project2 p:1\n 6 x 2014-12-12 Completed but with date:2014-12-12\n")
self.assertEquals(self.errors, "")
def test_list6(self):
......@@ -125,7 +125,7 @@ class ListCommandTest(CommandTest.CommandTest):
command.execute()
self.assertFalse(self.todolist.is_dirty())
self.assertEquals(self.output, " 1 (C) Foo @Context2 Not@Context +Project1 Not+Project\n 3 (C) Baz @Context1 +Project1 key:value id:1\n 4 (C) Drink beer @ home\n 5 (C) 13 + 29 = 42\n")
self.assertEquals(self.output, " 1 (C) Foo @Context2 Not@Context +Project1 Not+Project\n 3 (C) Baz @Context1 +Project1 key:value id:1\n 4 (C) Drink beer @ home\n 5 (C) 13 + 29 = 42\n 6 x 2014-12-12 Completed but with date:2014-12-12\n")
self.assertEquals(self.errors, "")
def test_list14(self):
......@@ -154,6 +154,13 @@ class ListCommandTest(CommandTest.CommandTest):
self.assertEquals(self.output, " 3 (C) Baz @Context1 +Project1 key:value id:1\n")
self.assertEquals(self.errors, "")
def test_list18(self):
command = ListCommand(["-x", "date:2014-12-12"], self.todolist, self.out, self.error)
command.execute()
self.assertFalse(self.todolist.is_dirty())
self.assertEquals(self.output, " 6 x 2014-12-12 Completed but with date:2014-12-12\n")
def test_help(self):
command = ListCommand(["help"], self.todolist, self.out, self.error)
command.execute()
......
......@@ -4,3 +4,4 @@
(C) Drink beer @ home
(C) 13 + 29 = 42
x 2014-12-12 Completed but with date:2014-12-12
......@@ -168,7 +168,7 @@ class OrdinalTagFilter(Filter):
if not self.key or not p_todo.has_tag(self.key):
return False
if self.key == config().tag_due() or self.key == config().tag_start():
try:
operand1 = date_string_to_date(p_todo.tag_value(self.key))
operand2 = relative_date_to_date(self.value)
......@@ -176,8 +176,8 @@ class OrdinalTagFilter(Filter):
operand2 = date_string_to_date(self.value)
if not operand1 or not operand2:
return False
else:
raise ValueError
except ValueError:
try:
operand1 = int(p_todo.tag_value(self.key))
operand2 = int(self.value)
......
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