def print_tree(self, cid, level=1, maxlevel=-1): collection = self.get_collection_with_id(cid) print hf.row_string([level, SQLHelper.get_node_str(collection, level)], [9, 50]) level = level + 1 if maxlevel != -1 and level > maxlevel: return for child in self.get_child_collections_of_id(cid): self.print_tree(child.id, level, maxlevel)
def print_collection(instance): assert is_collection(instance) print hf.row_string([instance.id, instance.parent_id, instance.is_category, instance.name], [6, 6, 10, 50])
def get_node_str(collection, level=1): node_str = hf.row_string([collection.id, collection.parent_id, collection.name], [8, 8, 50]) return node_str