from db.question import QuestionPool class QuestionList: def __init__(self, cursor): self.cursor = cursor def render(self, test_id = None): qp = QuestionPool(self.cursor) if test_id: rendered_questions = [i.render_short(self.cursor) for i in qp.select_by_test_id(test_id)] else: rendered_questions = [i.render_short(self.cursor) for i in qp.iter()] return "\n".join(rendered_questions)