request.form.has_key() is depricated, so I changed it
This commit is contained in:
parent
59e852f516
commit
59c3e8475c
1 changed files with 4 additions and 3 deletions
7
main.py
7
main.py
|
@ -44,12 +44,13 @@ def home():
|
||||||
@app.route("/statusUpdate", methods=["POST", "GET"])
|
@app.route("/statusUpdate", methods=["POST", "GET"])
|
||||||
def statusUpdate():
|
def statusUpdate():
|
||||||
if people and request.method == "POST":
|
if people and request.method == "POST":
|
||||||
if request.form.has_key("index"):
|
result = request.form
|
||||||
|
if "index" in result:
|
||||||
index = int(request.form["index"])
|
index = int(request.form["index"])
|
||||||
people[index].status += 1
|
people[index].status += 1
|
||||||
if people[index].status == 3:
|
if people[index].status == 3:
|
||||||
people.remove(people[index])
|
people.remove(people[index])
|
||||||
if request.form.has_key("name"):
|
if "name" in result:
|
||||||
index = people.index(Person(request.form["name"]))
|
index = people.index(Person(request.form["name"]))
|
||||||
print(index)
|
print(index)
|
||||||
people[index].status += 1
|
people[index].status += 1
|
||||||
|
@ -62,7 +63,7 @@ def statusUpdate():
|
||||||
def addPerson():
|
def addPerson():
|
||||||
if request.method == "POST":
|
if request.method == "POST":
|
||||||
result = request.form
|
result = request.form
|
||||||
if result.has_key("name"):
|
if "name" in result:
|
||||||
newPerson = Person(result["name"], result["remark"])
|
newPerson = Person(result["name"], result["remark"])
|
||||||
if newPerson not in people:
|
if newPerson not in people:
|
||||||
people.append(newPerson)
|
people.append(newPerson)
|
||||||
|
|
Loading…
Reference in a new issue