Skip to content
Snippets Groups Projects
Commit 7ad65959 authored by Ben Adida's avatar Ben Adida
Browse files

voter obj not serializable to JSON, which is how we're pickling sessions now,...

voter obj not serializable to JSON, which is how we're pickling sessions now, so moving to voter_id serialization
parent 1f7fcde6
No related branches found
No related tags found
No related merge requests found
......@@ -26,8 +26,8 @@ def get_voter(request, user, election):
return the current voter
"""
voter = None
if request.session.has_key('CURRENT_VOTER'):
voter = request.session['CURRENT_VOTER']
if request.session.has_key('CURRENT_VOTER_ID'):
voter = Voter.objects.get(id=request.session['CURRENT_VOTER_ID'])
if voter.election != election:
voter = None
......
......@@ -591,7 +591,7 @@ def password_voter_login(request, election):
voter = election.voter_set.get(voter_login_id = password_login_form.cleaned_data['voter_id'].strip(),
voter_password = password_login_form.cleaned_data['password'].strip())
request.session['CURRENT_VOTER'] = voter
request.session['CURRENT_VOTER_ID'] = voter.id
# if we're asked to cast, let's do it
if request.POST.get('cast_ballot') == "1":
......@@ -753,7 +753,7 @@ def one_election_cast_done(request, election):
logout = settings.LOGOUT_ON_CONFIRMATION
else:
logout = False
del request.session['CURRENT_VOTER']
del request.session['CURRENT_VOTER_ID']
save_in_session_across_logouts(request, 'last_vote_hash', vote_hash)
save_in_session_across_logouts(request, 'last_vote_cv_url', cv_url)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment