def remove_test(self): id = int(h.escape(request.params.get('id'))) testsuite = Session.query(TestSuite).get(id) if testsuite: Session.delete(testsuite) Session.commit() redirect(url(controller='tests', action='index'))
def remove_question(self, id): question_id = h.escape(request.params.get('id')) question = Session.query(Question).get(int(question_id)) testsuite = Session.query(TestSuite).get(int(id)) if question and testsuite: Session.delete(question) Session.commit() redirect(url(controller='tests', action='edit_test', id=testsuite.id)) else: redirect(url(controller='tests', action='index'))
def remove_answer(self, id, testsuite_id): answer_id = h.escape(request.params.get('id')) answer = Session.query(Answer).get(int(answer_id)) question = Session.query(Question).get(int(id)) testsuite = Session.query(TestSuite).get(int(testsuite_id)) if answer and question and testsuite: Session.delete(answer) Session.commit() redirect(url(controller='tests', action='edit_question', id=question.id, testsuite_id=testsuite.id)) elif testsuite: redirect(url(controller='tests', action='edit_test', id=testsuite.id)) else: redirect(url(controller='tests', action='index'))