Commit cc5fd993 authored by Mathis Dedial's avatar Mathis Dedial
Browse files

Remove some getattrs

parent 191682c4
Pipeline #2730 passed with stage
in 22 seconds
......@@ -55,12 +55,12 @@ def vote():
# User is casting their vote
if request.form.get('action') == 'like':
# Check if the user hasn't already voted for the same burger
if Vote.query.filter_by(nethz=getattr(session, 'user', ''), burger_id=burger_id).first():
if Vote.query.filter_by(nethz=session['user']), burger_id=burger_id).first():
return die('You have already liked this burger.')
# Add vote
vote = Vote(
nethz=getattr(session, 'user', None),
......@@ -70,7 +70,7 @@ def vote():
# User is revoking their vote
elif request.form.get('action') == 'unlike':
# Find the vote
vote = Vote.query.filter_by(nethz=getattr(session, 'user', None), burger_id=burger_id).first()
vote = Vote.query.filter_by(nethz=session['user'], burger_id=burger_id).first()
if vote:
# Delete the vote
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment