@app.route("/quote", methods=["GET", "POST"]) @login_required def quote(): if request =="POST": rows = lookup(request.form.get("quote"))

    if not rows:
        return apology("Invalid Symbol")

    return render_template("quote.html", stock=rows)
    return render_template("quote.html")

return render_template("quote.html")

@app.route("/register", methods=["GET","POST"]) def register(): if request.method == "POST":

    if request.form.get("username")=='null':
        return render_template("Provide a username")

    elif request.form.get("password")=='null':
        return render_template("Provide a password")

    elif request.form.get("confirmation")=='null':
        return render_template("checking for password")

    elif request.form.get("password") != request.form.get("confirmation"):
        return apology("password and confirmation don't match!")

    result = db.execute("INSERT INTO users (username, hash) \
                         VALUES(:username, :hash)", \
                         username=request.form.get("username"), \

    if not result:
        return apology("Username already exists! Please try another one")

    rows = db.execute("SELECT * from users WHERE username = :username", username = request.form.get("username"))
    session["user_id"] = rows[0]["id"]
    return redirect(url_for("index"))
    return render_template("register.html")
  • Please clarify what apology you are expecting and what system does instead. Jun 25, 2017 at 20:15
  • quote.html is not taking the value and it redirects to the same page instead of showing some data from the lookup folder .It is unable find the symbol and display information about the share. Please provide me with some logic. Quote.html is not returning the apology when no data is provided to it "Invalid Symbol ". Jun 26, 2017 at 10:52

1 Answer 1


Looks like a problem here if request =="POST":. request is never equal POST. Review the login function (or your own register function) to realize the correct object to test.

  • and one more thing, method get and method post should render different html template. @DinoCodeSaurus, one question though, not sure 'if not rows' and 'if rows == None' the same thing? Jun 26, 2017 at 12:46
  • @MichaelZhang: Yes, "None" is "Falsey". Python Truth Value Testing Jun 26, 2017 at 12:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .