def post_quiz(): config = quiz.get_config() resposta = {"data":datetime.now()} for pergunta in config["paginas"]: key = pergunta['nome'] if pergunta['tipo'] == "formulario": for i in range(0,len(pergunta["itens"])): skey = "%s_%s" % (key,i) resposta[skey] = request.forms[skey] else: resposta[key] = request.forms[key] quiz.save_data(resposta) redirect("/")
def get_quiz(): config = quiz.get_config() return template("quiz", **config)