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):
return filters
def _print(self):
""" Prints the todos. """
def _view(self):
sorter = Sorter(self.sort_expression)
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()
self.out(view.pretty_print([PrettyPrinterIndentFilter(indent)]))
self.out(self._view().pretty_print([PrettyPrinterIndentFilter(indent)]))
def execute(self):
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