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

Merge pull request #82 from benadida/update-to-django-1.6

update to django 1.6
parents d61f5dbd 70571930
No related branches found
No related tags found
No related merge requests found
Showing
with 25 additions and 27 deletions
...@@ -2,9 +2,7 @@ ...@@ -2,9 +2,7 @@
Crypto Utils Crypto Utils
""" """
import hmac, base64 import hmac, base64, json
from django.utils import simplejson
from hashlib import sha256 from hashlib import sha256
...@@ -18,8 +16,8 @@ def hash_b64(s): ...@@ -18,8 +16,8 @@ def hash_b64(s):
return result return result
def to_json(d): def to_json(d):
return simplejson.dumps(d, sort_keys=True) return json.dumps(d, sort_keys=True)
def from_json(json_str): def from_json(json_str):
if not json_str: return None if not json_str: return None
return simplejson.loads(json_str) return json.loads(json_str)
...@@ -7,10 +7,10 @@ and adapted to LDObject ...@@ -7,10 +7,10 @@ and adapted to LDObject
""" """
import datetime import datetime
import json
from django.db import models from django.db import models
from django.db.models import signals from django.db.models import signals
from django.conf import settings from django.conf import settings
from django.utils import simplejson as json
from django.core.serializers.json import DjangoJSONEncoder from django.core.serializers.json import DjangoJSONEncoder
from . import LDObject from . import LDObject
......
...@@ -176,7 +176,7 @@ class DLogProof(LegacyObject): ...@@ -176,7 +176,7 @@ class DLogProof(LegacyObject):
def __init__(self, wrapped_obj): def __init__(self, wrapped_obj):
if isinstance(wrapped_obj, dict): if isinstance(wrapped_obj, dict):
import pdb; pdb.set_trace() raise Exception("problem with dict")
super(DLogProof,self).__init__(wrapped_obj) super(DLogProof,self).__init__(wrapped_obj)
......
...@@ -4,7 +4,7 @@ Helios URLs for Election related stuff ...@@ -4,7 +4,7 @@ Helios URLs for Election related stuff
Ben Adida (ben@adida.net) Ben Adida (ben@adida.net)
""" """
from django.conf.urls.defaults import * from django.conf.urls import *
from helios.views import * from helios.views import *
......
...@@ -7,7 +7,7 @@ Ben Adida ...@@ -7,7 +7,7 @@ Ben Adida
""" """
from django.db import models, transaction from django.db import models, transaction
from django.utils import simplejson import json
from django.conf import settings from django.conf import settings
from django.core.mail import send_mail from django.core.mail import send_mail
......
...@@ -26,8 +26,8 @@ def get_voter(request, user, election): ...@@ -26,8 +26,8 @@ def get_voter(request, user, election):
return the current voter return the current voter
""" """
voter = None voter = None
if request.session.has_key('CURRENT_VOTER'): if request.session.has_key('CURRENT_VOTER_ID'):
voter = request.session['CURRENT_VOTER'] voter = Voter.objects.get(id=request.session['CURRENT_VOTER_ID'])
if voter.election != election: if voter.election != election:
voter = None voter = None
......
...@@ -4,7 +4,7 @@ Helios URLs for Election related stuff ...@@ -4,7 +4,7 @@ Helios URLs for Election related stuff
Ben Adida (ben@adida.net) Ben Adida (ben@adida.net)
""" """
from django.conf.urls.defaults import * from django.conf.urls import *
from helios.stats_views import * from helios.stats_views import *
......
Please provide the voter ID and password you received by email.<br /><br /> Please provide the voter ID and password you received by email.<br /><br />
<form method="post" action="{% url helios.views.password_voter_login election.uuid %}" onsubmit="show_waiting()"> <form method="post" action="{% url "helios.views.password_voter_login" election.uuid %}" onsubmit="show_waiting()">
<input type="hidden" name="csrf_token" value="{{csrf_token}}" /> <input type="hidden" name="csrf_token" value="{{csrf_token}}" />
<input type="hidden" name="return_url" value="{{return_url}}" /> <input type="hidden" name="return_url" value="{{return_url}}" />
<input type="hidden" name="cast_ballot" value="{{cast_ballot}}" /> <input type="hidden" name="cast_ballot" value="{{cast_ballot}}" />
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
{% endif %} {% endif %}
<p style="font-size: 1.4em;"> <p style="font-size: 1.4em;">
[ <a href="{% url helios.views.one_election_view election.uuid %}">return to election info</a> ] [ <a href="{% url "helios.views.one_election_view" election.uuid %}">return to election info</a> ]
</p> </p>
{% endblock %} {% endblock %}
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
{% block title %}{{cast_vote.vote_tinyhash}} &mdash; {{election.name}}{% endblock %} {% block title %}{{cast_vote.vote_tinyhash}} &mdash; {{election.name}}{% endblock %}
{% block content %} {% block content %}
<h2 class="title">Cast Vote {{cast_vote.vote_tinyhash}}</h2> <h2 class="title">Cast Vote {{cast_vote.vote_tinyhash}}</h2>
cast in <a href="{% url helios.views.one_election_view election.uuid %}">{{election.name}}</a><br /> cast in <a href="{% url "helios.views.one_election_view" election.uuid %}">{{election.name}}</a><br />
Fingerprint: <tt>{{cast_vote.vote_hash}}</tt><br /> Fingerprint: <tt>{{cast_vote.vote_hash}}</tt><br />
by <b><u> by <b><u>
{% if the_voter.alias %} {% if the_voter.alias %}
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
{% block title %}Compute Tally &mdash; {{election.name}}{% endblock %} {% block title %}Compute Tally &mdash; {{election.name}}{% endblock %}
{% block content %} {% block content %}
<h2 class="title">{{election.name}} &mdash; Compute Tally <span style="font-size:0.7em;">[<a href="{% url helios.views.one_election_view election.uuid %}">cancel</a>]</span></h2> <h2 class="title">{{election.name}} &mdash; Compute Tally <span style="font-size:0.7em;">[<a href="{% url "helios.views.one_election_view" election.uuid %}">cancel</a>]</span></h2>
<p> <p>
You are about to compute the tally for this election. You only will then see the results. You are about to compute the tally for this election. You only will then see the results.
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
{% block title %}Audited Ballots for {{election.name}}{% endblock %} {% block title %}Audited Ballots for {{election.name}}{% endblock %}
{% block content %} {% block content %}
<h2 class="title">{{election.name}} &mdash; Audited Ballots <span style="font-size:0.7em;">[<a href="{% url helios.views.one_election_view election_uuid=election.uuid %}">back to election</a>]</span></h2> <h2 class="title">{{election.name}} &mdash; Audited Ballots <span style="font-size:0.7em;">[<a href="{% url "helios.views.one_election_view" election_uuid=election.uuid %}">back to election</a>]</span></h2>
<p> <p>
When you prepare a ballot with Helios, you immediately receive a smart ballot tracker. Before you choose to cast that ballot, you have the option to ask Helios to "break open" that encrypted ballot and verify that Helios encrypted your ballot correctly. Once that's done, you can post that opened ballot here, on the audited ballots' list, for everyone to verify (your identity is not included). Once you've done this, you have to re-encrypt your choices and obtain a different smart ballot tracker. This helps reduce the chance that someone might coerce you to vote differently from your true choice. When you prepare a ballot with Helios, you immediately receive a smart ballot tracker. Before you choose to cast that ballot, you have the option to ask Helios to "break open" that encrypted ballot and verify that Helios encrypted your ballot correctly. Once that's done, you can post that opened ballot here, on the audited ballots' list, for everyone to verify (your identity is not included). Once you've done this, you have to re-encrypt your choices and obtain a different smart ballot tracker. This helps reduce the chance that someone might coerce you to vote differently from your true choice.
...@@ -14,7 +14,7 @@ These ballots are <em>not cast</em>, and they will not be counted. They are just ...@@ -14,7 +14,7 @@ These ballots are <em>not cast</em>, and they will not be counted. They are just
</p> </p>
<p> <p>
To verify an audited ballot, copy its entire content and paste it in the <a target="_new" href="/booth/single-ballot-verify.html?election_url={% url helios.views.one_election election.uuid %}">single ballot verifier</a>. To verify an audited ballot, copy its entire content and paste it in the <a target="_new" href="/booth/single-ballot-verify.html?election_url={% url "helios.views.one_election" election.uuid %}">single ballot verifier</a>.
</p> </p>
{% if audited_ballots %} {% if audited_ballots %}
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
{% block title %}Ballot Tracking Center for {{election.name}}{% endblock %} {% block title %}Ballot Tracking Center for {{election.name}}{% endblock %}
{% block content %} {% block content %}
<h2 class="title">{{election.name}} &mdash; Ballot Tracking Center <span style="font-size:0.7em;">[<a href="{% url helios.views.one_election_view election_uuid=election.uuid %}">back to election</a>]</span></h2> <h2 class="title">{{election.name}} &mdash; Ballot Tracking Center <span style="font-size:0.7em;">[<a href="{% url "helios.views.one_election_view" election_uuid=election.uuid %}">back to election</a>]</span></h2>
<p> <p>
This is the ballot tracking center, which displays the tracking numbers of all cast ballots in this election. This is the ballot tracking center, which displays the tracking numbers of all cast ballots in this election.
...@@ -40,7 +40,7 @@ Name ...@@ -40,7 +40,7 @@ Name
{{voter.alias}} {{voter.alias}}
{% else %} {% else %}
<img border="0" height="20" src="/static/auth/login-icons/{{voter.voter_type}}.png" alt="{{voter.voter_type}}" /> {% if voter.name %}{{voter.name}}{% else %}{{voter.voter_id}}{% endif %} <img border="0" height="20" src="/static/auth/login-icons/{{voter.voter_type}}.png" alt="{{voter.voter_type}}" /> {% if voter.name %}{{voter.name}}{% else %}{{voter.voter_id}}{% endif %}
{% endif %}</td><td><tt style="font-size: 1.4em;;">{% if voter.vote_hash %}{{voter.vote_hash}} <span style="font-size:0.8em;">[<a href="{% url helios.views.voter_last_vote election_uuid=election.uuid,voter_uuid=voter.uuid %}">view</a>]</span>{% else %}&mdash;{% endif %}</tt></td></tr> {% endif %}</td><td><tt style="font-size: 1.4em;;">{% if voter.vote_hash %}{{voter.vote_hash}} <span style="font-size:0.8em;">[<a href="{% url "helios.views.voter_last_vote" election_uuid=election.uuid voter_uuid=voter.uuid %}">view</a>]</span>{% else %}&mdash;{% endif %}</tt></td></tr>
{% endfor %} {% endfor %}
</table> </table>
......
{% extends "helios/templates/cryptobase.html" %} {% extends "helios/templates/cryptobase.html" %}
{% block content %} {% block content %}
<h2 class="title">{{election.name}} &mdash; Questions <span style="font-size:0.7em;">[<a href="{% url helios.views.one_election_view election.uuid %}">back to election</a>]</span></h2> <h2 class="title">{{election.name}} &mdash; Questions <span style="font-size:0.7em;">[<a href="{% url "helios.views.one_election_view" election.uuid %}">back to election</a>]</span></h2>
<script language="javascript"> <script language="javascript">
{% if election.questions %} {% if election.questions %}
......
...@@ -73,7 +73,7 @@ requires election-specific credentials. ...@@ -73,7 +73,7 @@ requires election-specific credentials.
{% endif %} {% endif %}
</b><br /></p> </b><br /></p>
<p> <p>
[<a href="{% url helios.views.one_election_view election.uuid %}">return to the main election page</a>] [<a href="{% url "helios.views.one_election_view" election.uuid %}">return to the main election page</a>]
</p> </p>
{% else %} {% else %}
<p> <p>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
{% block content %} {% block content %}
<h2 class="title">{{election.name}} &mdash; Update <span style="font-size:0.7em;">[<a href="{% url helios.views.one_election_view election.uuid %}">cancel</a>]</span></h2> <h2 class="title">{{election.name}} &mdash; Update <span style="font-size:0.7em;">[<a href="{% url "helios.views.one_election_view" election.uuid %}">cancel</a>]</span></h2>
{% if error %} {% if error %}
<p style="color: red;"> <p style="color: red;">
......
...@@ -29,7 +29,7 @@ You must freeze the ballot before you can contact voters. ...@@ -29,7 +29,7 @@ You must freeze the ballot before you can contact voters.
<li>{{issue.action}}</li> <li>{{issue.action}}</li>
{% endfor %} {% endfor %}
</ul> </ul>
<a href="{% url helios.views.one_election_view election.uuid %}">go back to the election</a> <a href="{% url "helios.views.one_election_view" election.uuid %}">go back to the election</a>
</p> </p>
{% else %} {% else %}
<form method="post" action=""> <form method="post" action="">
......
...@@ -134,7 +134,7 @@ Your key has been generated, but you may choose to<br /><a href="javascript:clea ...@@ -134,7 +134,7 @@ Your key has been generated, but you may choose to<br /><a href="javascript:clea
</p> </p>
</div> </div>
<form method="post" id="pk_form" action="{% url helios.views.trustee_upload_pk election.uuid, trustee.uuid %}"> <form method="post" id="pk_form" action="{% url "helios.views.trustee_upload_pk" election.uuid trustee.uuid %}">
<h3>Your Public Key</h3> <h3>Your Public Key</h3>
<p> <p>
It's time to upload the public key to the server. It's time to upload the public key to the server.
......
...@@ -56,7 +56,7 @@ $(document).ready(function() { ...@@ -56,7 +56,7 @@ $(document).ready(function() {
<b>An election managed by multiple trustees</b>. <b>An election managed by multiple trustees</b>.
{% endifequal %} {% endifequal %}
{% endifequal %} {% endifequal %}
<form class="prettyform" action="{% url helios.views.election_new_3 %}" method="POST" id="create_election_form" onsubmit="return before_create();"> <form class="prettyform" action="{% url "helios.views.election_new_3" %}" method="POST" id="create_election_form" onsubmit="return before_create();">
<input type="hidden" name="csrf_token" value="{{csrf_token}}" /> <input type="hidden" name="csrf_token" value="{{csrf_token}}" />
<input type="hidden" name="name" value="{{name}}" /> <input type="hidden" name="name" value="{{name}}" />
<input type="hidden" name="public_key" id="pk" value="" /> <input type="hidden" name="public_key" id="pk" value="" />
......
...@@ -9,6 +9,6 @@ ...@@ -9,6 +9,6 @@
</p> </p>
<p> <p>
<a href="{% url helios.views.one_election_view election.uuid %}">back to the election</a> <a href="{% url "helios.views.one_election_view" election.uuid %}">back to the election</a>
</p> </p>
{% endblock %} {% endblock %}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment