Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Helios Server
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TO
Helios Server
Commits
e4ecd0b8
Commit
e4ecd0b8
authored
14 years ago
by
Ben Adida
Browse files
Options
Downloads
Patches
Plain Diff
fixed a bug where election URL was not displayed, and made sure emailed link is direct to go vote
parent
3204a743
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
helios/__init__.py
+3
-0
3 additions, 0 deletions
helios/__init__.py
helios/models.py
+2
-2
2 additions, 2 deletions
helios/models.py
helios/urls.py
+1
-0
1 addition, 0 deletions
helios/urls.py
helios/views.py
+16
-3
16 additions, 3 deletions
helios/views.py
with
22 additions
and
5 deletions
helios/__init__.py
+
3
−
0
View file @
e4ecd0b8
from
django.conf
import
settings
from
django.conf
import
settings
from
django.core.urlresolvers
import
reverse
from
helios.views
import
election_shortcut
TEMPLATE_BASE
=
settings
.
HELIOS_TEMPLATE_BASE
or
"
helios/templates/base.html
"
TEMPLATE_BASE
=
settings
.
HELIOS_TEMPLATE_BASE
or
"
helios/templates/base.html
"
...
@@ -12,3 +14,4 @@ VOTERS_UPLOAD = settings.HELIOS_VOTERS_UPLOAD
...
@@ -12,3 +14,4 @@ VOTERS_UPLOAD = settings.HELIOS_VOTERS_UPLOAD
# allow emailing of voters?
# allow emailing of voters?
VOTERS_EMAIL
=
settings
.
HELIOS_VOTERS_EMAIL
VOTERS_EMAIL
=
settings
.
HELIOS_VOTERS_EMAIL
This diff is collapsed.
Click to expand it.
helios/models.py
+
2
−
2
View file @
e4ecd0b8
...
@@ -15,7 +15,7 @@ import datetime, logging, uuid, random
...
@@ -15,7 +15,7 @@ import datetime, logging, uuid, random
from
crypto
import
electionalgs
,
algs
,
utils
from
crypto
import
electionalgs
,
algs
,
utils
from
helios
import
utils
as
heliosutils
from
helios
import
utils
as
heliosutils
import
helios
import
helios
.views
from
helios
import
datatypes
from
helios
import
datatypes
...
@@ -460,7 +460,7 @@ class Election(HeliosModel):
...
@@ -460,7 +460,7 @@ class Election(HeliosModel):
@property
@property
def
url
(
self
):
def
url
(
self
):
return
helios
.
get_election_url
(
self
)
return
helios
.
views
.
get_election_url
(
self
)
def
init_tally
(
self
):
def
init_tally
(
self
):
# FIXME: create the right kind of tally
# FIXME: create the right kind of tally
...
...
This diff is collapsed.
Click to expand it.
helios/urls.py
+
1
−
0
View file @
e4ecd0b8
...
@@ -18,6 +18,7 @@ urlpatterns = patterns('',
...
@@ -18,6 +18,7 @@ urlpatterns = patterns('',
# election shortcut by shortname
# election shortcut by shortname
(
r
'
^e/(?P<election_short_name>[^/]+)$
'
,
election_shortcut
),
(
r
'
^e/(?P<election_short_name>[^/]+)$
'
,
election_shortcut
),
(
r
'
^e/(?P<election_short_name>[^/]+)/vote$
'
,
election_vote_shortcut
),
# vote shortcut
# vote shortcut
(
r
'
^v/(?P<vote_tinyhash>[^/]+)$
'
,
castvote_shortcut
),
(
r
'
^v/(?P<vote_tinyhash>[^/]+)$
'
,
castvote_shortcut
),
...
...
This diff is collapsed.
Click to expand it.
helios/views.py
+
16
−
3
View file @
e4ecd0b8
...
@@ -49,10 +49,12 @@ ELGAMAL_PARAMS_LD_OBJECT = datatypes.LDObject.instantiate(ELGAMAL_PARAMS, dataty
...
@@ -49,10 +49,12 @@ ELGAMAL_PARAMS_LD_OBJECT = datatypes.LDObject.instantiate(ELGAMAL_PARAMS, dataty
# single election server? Load the single electionfrom models import Election
# single election server? Load the single electionfrom models import Election
from
django.conf
import
settings
from
django.conf
import
settings
# a helper function
def
get_election_url
(
election
):
def
get_election_url
(
election
):
return
settings
.
URL_HOST
+
reverse
(
election_shortcut
,
args
=
[
election
.
short_name
])
return
settings
.
URL_HOST
+
reverse
(
election_shortcut
,
args
=
[
election
.
short_name
])
def
get_election_govote_url
(
election
):
return
settings
.
URL_HOST
+
reverse
(
election_vote_shortcut
,
args
=
[
election
.
short_name
])
def
get_castvote_url
(
cast_vote
):
def
get_castvote_url
(
cast_vote
):
return
settings
.
URL_HOST
+
reverse
(
castvote_shortcut
,
args
=
[
cast_vote
.
vote_tinyhash
])
return
settings
.
URL_HOST
+
reverse
(
castvote_shortcut
,
args
=
[
cast_vote
.
vote_tinyhash
])
...
@@ -137,6 +139,17 @@ def election_shortcut(request, election_short_name):
...
@@ -137,6 +139,17 @@ def election_shortcut(request, election_short_name):
else
:
else
:
raise
Http404
raise
Http404
def
election_vote_shortcut
(
request
,
election_short_name
):
election
=
Election
.
get_by_short_name
(
election_short_name
)
if
election
:
vote_url
=
"
%s/booth/vote.html?%s
"
%
(
settings
.
SECURE_URL_HOST
,
urllib
.
urlencode
({
'
election_url
'
:
reverse
(
one_election
,
args
=
[
election
.
uuid
])}))
test_cookie_url
=
"
%s?%s
"
%
(
reverse
(
test_cookie
),
urllib
.
urlencode
({
'
continue_url
'
:
vote_url
}))
return
HttpResponseRedirect
(
test_cookie_url
)
else
:
raise
Http404
def
castvote_shortcut
(
request
,
vote_tinyhash
):
def
castvote_shortcut
(
request
,
vote_tinyhash
):
try
:
try
:
cast_vote
=
CastVote
.
objects
.
get
(
vote_tinyhash
=
vote_tinyhash
)
cast_vote
=
CastVote
.
objects
.
get
(
vote_tinyhash
=
vote_tinyhash
)
...
@@ -1165,7 +1178,7 @@ def voters_email(request, election):
...
@@ -1165,7 +1178,7 @@ def voters_email(request, election):
extra_vars
=
{
extra_vars
=
{
'
custom_subject
'
:
email_form
.
cleaned_data
[
'
subject
'
],
'
custom_subject
'
:
email_form
.
cleaned_data
[
'
subject
'
],
'
custom_message
'
:
email_form
.
cleaned_data
[
'
body
'
],
'
custom_message
'
:
email_form
.
cleaned_data
[
'
body
'
],
'
election_url
'
:
get_election_url
(
election
),
'
election_url
'
:
get_election_
govote_
url
(
election
),
'
election
'
:
election
'
election
'
:
election
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment