request.form.has_key() is depricated, so I changed it

This commit is contained in:
Jan-Pieter Baert 2019-02-14 22:29:25 +01:00
parent 59e852f516
commit 59c3e8475c
No known key found for this signature in database
GPG key ID: B19186932178234A

View file

@ -44,12 +44,13 @@ def home():
@app.route("/statusUpdate", methods=["POST", "GET"])
def statusUpdate():
if people and request.method == "POST":
if request.form.has_key("index"):
result = request.form
if "index" in result:
index = int(request.form["index"])
people[index].status += 1
if people[index].status == 3:
people.remove(people[index])
if request.form.has_key("name"):
if "name" in result:
index = people.index(Person(request.form["name"]))
print(index)
people[index].status += 1
@ -62,7 +63,7 @@ def statusUpdate():
def addPerson():
if request.method == "POST":
result = request.form
if result.has_key("name"):
if "name" in result:
newPerson = Person(result["name"], result["remark"])
if newPerson not in people:
people.append(newPerson)