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
f9e73d16
Commit
f9e73d16
authored
11 years ago
by
Ben Adida
Browse files
Options
Downloads
Patches
Plain Diff
allowing for emails to go out without individual queueing
parent
4675376e
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
helios/tasks.py
+12
-1
12 additions, 1 deletion
helios/tasks.py
settings.py
+3
-0
3 additions, 0 deletions
settings.py
with
15 additions
and
1 deletion
helios/tasks.py
+
12
−
1
View file @
f9e73d16
...
...
@@ -13,6 +13,7 @@ import signals
import
copy
from
django.conf
import
settings
@task
()
def
cast_vote_verify_and_store
(
cast_vote_id
,
status_update_message
=
None
,
**
kwargs
):
...
...
@@ -52,7 +53,17 @@ def voters_email(election_id, subject_template, body_template, extra_vars={},
voters
=
voters
.
exclude
(
**
voter_constraints_exclude
)
for
voter
in
voters
:
single_voter_email
.
delay
(
voter
.
uuid
,
subject_template
,
body_template
,
extra_vars
)
if
settings
.
QUEUE_INDIVIDUAL_EMAILS
:
single_voter_email
.
delay
(
voter
.
uuid
,
subject_template
,
body_template
,
extra_vars
)
else
:
the_vars
=
copy
.
copy
(
extra_vars
)
the_vars
.
update
({
'
voter
'
:
voter
})
subject
=
render_template_raw
(
None
,
subject_template
,
the_vars
)
body
=
render_template_raw
(
None
,
body_template
,
the_vars
)
voter
.
user
.
send_message
(
subject
,
body
)
@task
()
def
voters_notify
(
election_id
,
notification_template
,
extra_vars
=
{}):
...
...
This diff is collapsed.
Click to expand it.
settings.py
+
3
−
0
View file @
f9e73d16
...
...
@@ -155,6 +155,9 @@ DEFAULT_FROM_EMAIL = get_from_env('DEFAULT_FROM_EMAIL', 'ben@adida.net')
DEFAULT_FROM_NAME
=
get_from_env
(
'
DEFAULT_FROM_NAME
'
,
'
Ben for Helios
'
)
SERVER_EMAIL
=
'
%s <%s>
'
%
(
DEFAULT_FROM_NAME
,
DEFAULT_FROM_EMAIL
)
# do we queue up each email as a job, or one job for all emails for a given election?
QUEUE_INDIVIDUAL_EMAILS
=
(
get_from_env
(
'
QUEUE_INDIVIDUAL_EMAILS
'
,
'
1
'
)
==
'
1
'
)
LOGIN_URL
=
'
/auth/
'
LOGOUT_ON_CONFIRMATION
=
True
...
...
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