示例#1
0
文件: main.py 项目: CleryFabien/lmfdb
def show():
    r"""
    This gets called when an adress of that kind gets loaded:

    http://127.0.0.1:37777/Permutations/show?data=3.4.2.1
    """
    assert request.method == "GET", "request.method is assumed to be GET"
    data = str(request.args.get('data', ''))
    try:
        data = map(Integer, data.split('.'))
        p = Permutation(data)
    except (TypeError, ValueError):
        logger.info("Impossible to create a permutation from input.")
        flask.flash("Ooops, impossible to create a permutation from given input!", "error")
        return flask.redirect(url_for(".index"))
    return render_template("permutations.html", permutation=p,
            rankbread=get_bread())
示例#2
0
def show():
    r"""
    This gets called when an adress of that kind gets loaded:

    http://127.0.0.1:37777/Permutations/show?data=3.4.2.1
    """
    assert request.method == "GET", "request.method is assumed to be GET"
    data = str(request.args.get('data', ''))
    try:
        data = map(Integer, data.split('.'))
        p = Permutation(data)
    except (TypeError, ValueError):
        logger.info("Impossible to create a permutation from input.")
        flash_error("Ooops, impossible to create a permutation from given input!")
        return flask.redirect(url_for(".index"))
    return render_template("permutations.html", permutation=p,
            rankbread=get_bread())