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"])
|
||||
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)
|
||||
|
|
Loading…
Reference in a new issue