def get_yml_todos(self): """ return the (cat, todos) tuple for create """ checklist = [] todos_by_cat = OrderedDict() logger.info('Get Project yml todo items and category') for c in self.checklist: if hasattr(c.todos, 'items'): for category, item in c.todos.items(): self.handle_repeater(item=item) todos_by_cat[category] = [] if item.checklist: # parse the list and assign extra attribs self.parse_checklist(current_length=len(checklist), checklist=item.checklist, category=category) todos_by_cat[category] = item.checklist checklist = list(checklist + item.checklist) return (todos_by_cat, checklist)
def get_db_todos(self): """ return the (cat, todos) tuple for create """ checklist = [] todos_by_cat = OrderedDict() logger.info("Get Project db todo items and category") for todo in self.db_todos(): checklist.append(todo) if todo.category not in todos_by_cat: todos_by_cat[todo.category] = [] todos_by_cat[todo.category].append(todo) return (todos_by_cat, checklist)