Commit 6f4de340 authored by Bram Schoenmakers's avatar Bram Schoenmakers

Separate methods for view construction and printing a view.

The IcalCommand, which inherits from this class, wants to use the same
view construction code, but needs a different implementation for
printing the view. Therefore these two things should be split.
parent 82f17dc6
...@@ -75,16 +75,16 @@ class ListCommand(Command): ...@@ -75,16 +75,16 @@ class ListCommand(Command):
return filters return filters
def _print(self): def _view(self):
""" Prints the todos. """
sorter = Sorter(self.sort_expression) sorter = Sorter(self.sort_expression)
filters = self._filters() filters = self._filters()
view = View(sorter, filters, self.todolist) return View(sorter, filters, self.todolist, self.printer)
def _print(self):
""" Prints the todos. """
indent = config().list_indent() indent = config().list_indent()
self.out(view.pretty_print([PrettyPrinterIndentFilter(indent)])) self.out(self._view().pretty_print([PrettyPrinterIndentFilter(indent)]))
def execute(self): def execute(self):
if not super(ListCommand, self).execute(): if not super(ListCommand, self).execute():
......
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