Exemplo n.º 1
0
Arquivo: app.py Projeto: flywind2/ohms
def update_question():
    admin = validate_admin()

    q_id = request.form['q_id']
    xml_new = request.form['xml']
    node = ET.fromstring(xml_new)
    node.attrib['id'] = q_id
    question = Question.from_xml(node)
    return json.dumps({
        "xml": question.xml,
        "html": question.to_html(),
    })
Exemplo n.º 2
0
Arquivo: app.py Projeto: dlsun/ohms
def update_question():
    admin = validate_admin()
    
    q_id = request.form['q_id']
    xml_new = request.form['xml']
    node = ET.fromstring(xml_new)
    node.attrib['id'] = q_id
    question = Question.from_xml(node)
    return json.dumps({
        "xml": question.xml,
        "html": question.to_html(),
    })
Exemplo n.º 3
0
Arquivo: app.py Projeto: flywind2/ohms
def add_question():
    admin = validate_admin()

    xml = request.form['xml']
    node = ET.fromstring(xml)

    # remove any ID tags
    for e in node.iter():
        if "id" in e.attrib: e.attrib.pop("id")

    question = Question.from_xml(node)
    question.homework = get_homework(request.form['hw_id'])

    session.commit()

    return "Question added successfully!"
Exemplo n.º 4
0
Arquivo: app.py Projeto: dlsun/ohms
def add_question():
    admin = validate_admin()

    xml = request.form['xml']
    node = ET.fromstring(xml)

    # remove any ID tags
    for e in node.iter():
        if "id" in e.attrib: e.attrib.pop("id")

    question = Question.from_xml(node)
    question.homework = get_homework(request.form['hw_id'])

    session.commit()

    return "Question added successfully!"