Commit a021c148 authored by Bram Schoenmakers's avatar Bram Schoenmakers

Don't let GrepFilter deal with integer expressions.

Just make sure that proper arguments are passed to GrepFilter in the
first place.
parent 09532f61
......@@ -185,13 +185,6 @@ class FilterTest(TopydoTest):
self.assertEqual(todolist_to_string(filtered_todos), \
todolist_to_string(reference))
def test_filter19(self):
todos = load_file('test/data/FilterTest1.txt')
grep = Filter.GrepFilter(1)
filtered_todos = grep.filter(todos)
self.assertEqual(filtered_todos, [])
def test_filter20(self):
todos = load_file('test/data/FilterTest3.txt')
otf = Filter.OrdinalTagFilter('due:<2014-11-10')
......
......@@ -15,7 +15,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import re
from six import text_type
from topydo.lib.Config import config
from topydo.lib.RelativeDate import relative_date_to_date
......@@ -64,7 +63,7 @@ class GrepFilter(Filter):
super(GrepFilter, self).__init__()
# convert to string in case we receive integers
self.expression = text_type(p_expression)
self.expression = p_expression
if p_case_sensitive != None:
self.case_sensitive = p_case_sensitive
......
......@@ -20,6 +20,7 @@ A list of todo items.
from datetime import date
import re
from six import text_type
from topydo.lib.Config import config
from topydo.lib import Filter
......@@ -124,7 +125,8 @@ class TodoListBase(object):
result = todo_by_linenumber(p_identifier)
if not result:
result = todo_by_regexp(p_identifier)
# convert integer to text so we pass on a valid regex
result = todo_by_regexp(text_type(p_identifier))
return result
......
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