def sorted_todos(self, done, is_tree_shaped, sort_order, legal_keys):
todos = [t for t in self.linked_todos_as_list if t.visible and t.done == done]
- reverse = False
- sort_column = sort_order[:]
- if sort_order and '-' == sort_order[0]:
- reverse = True
- sort_column = sort_order[1:]
- if sort_column in legal_keys:
- todos.sort(key=lambda t: getattr(t, sort_column))
- if reverse:
- todos.reverse()
+ if sort_order:
+ reverse = False
+ sort_column = sort_order[:]
+ if sort_order and '-' == sort_order[0]:
+ reverse = True
+ sort_column = sort_order[1:]
+ if sort_column in legal_keys:
+ todos.sort(key=lambda t: getattr(t, sort_column))
+ if reverse:
+ todos.reverse()
if is_tree_shaped:
def walk_tree(todo, sorted_todos):
todo.deps = [t for t in sorted_todos if t in todo.deps]