Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
12990a99
Commit
12990a99
authored
Jul 29, 2013
by
Sef Kloninger
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/kluo/bulk-email-squashed' into edx-west/release-candidate-20130729
parents
74b4420c
131979e1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
16 deletions
+9
-16
lms/djangoapps/bulk_email/tasks.py
+7
-14
lms/templates/emails/email_footer.html
+1
-1
lms/templates/emails/email_footer.txt
+1
-1
No files found.
lms/djangoapps/bulk_email/tasks.py
View file @
12990a99
...
...
@@ -20,7 +20,7 @@ from mitxmako.shortcuts import render_to_string
log
=
logging
.
getLogger
(
__name__
)
@task
()
@task
(
default_retry_delay
=
10
,
max_retries
=
5
)
def
delegate_email_batches
(
hash_for_msg
,
recipient
,
course_id
,
course_url
,
user_id
):
'''
Delegates emails by querying for the list of recipients who should
...
...
@@ -37,18 +37,11 @@ def delegate_email_batches(hash_for_msg, recipient, course_id, course_url, user_
log
.
error
(
"get_course_by_id failed: "
+
exc
.
args
[
0
])
raise
Exception
(
"get_course_by_id failed: "
+
exc
.
args
[
0
])
email
=
None
retries
=
0
while
email
is
None
:
try
:
email
=
CourseEmail
.
objects
.
get
(
hash
=
hash_for_msg
)
except
CourseEmail
.
DoesNotExist
as
exc
:
if
retries
<
3
:
retries
+=
1
time
.
sleep
(
5
)
else
:
log
.
error
(
"Failed to get CourseEmail with hash "
+
hash_for_msg
+
", no workers fired."
)
return
0
try
:
email
=
CourseEmail
.
objects
.
get
(
hash
=
hash_for_msg
)
except
CourseEmail
.
DoesNotExist
as
exc
:
log
.
warning
(
"Failed to get CourseEmail with hash
%
s, retry
%
d"
%
(
hash_for_msg
,
current_task
.
request
.
retries
))
raise
delegate_email_batches
.
retry
(
arg
=
[
hash_for_msg
,
recipient
,
course_id
,
course_url
,
user_id
],
exc
=
exc
)
if
recipient
==
"myself"
:
recipient_qset
=
User
.
objects
.
filter
(
id
=
user_id
)
.
values
(
'profile__name'
,
'email'
)
...
...
@@ -140,7 +133,7 @@ def course_email(hash_for_msg, to_list, course_title, course_url, throttle=False
raise
exc
# this will cause the outer handler to catch the exception and retry the entire task
else
:
#this will fall through and not retry the message, since it will be popped
log
.
warn
(
'Email with hash '
+
hash_for_msg
+
' not delivered to '
+
email
+
' due to error: '
+
exc
.
smtp_error
)
log
.
warn
ing
(
'Email with hash '
+
hash_for_msg
+
' not delivered to '
+
email
+
' due to error: '
+
exc
.
smtp_error
)
num_error
+=
1
to_list
.
pop
()
...
...
lms/templates/emails/email_footer.html
View file @
12990a99
<
%!
from
django
.
core
.
urlresolvers
import
reverse
%
>
<br
/>
----
<br
/>
This email was automatically sent from ${settings.PLATFORM_NAME}
to ${name}
.
<br
/>
This email was automatically sent from ${settings.PLATFORM_NAME}.
<br
/>
You are receiving this email at address ${ email } because you are enrolled in
<a
href=
"${course_url}"
>
${ course_title }
</a>
.
<br
/>
To stop receiving email like this, update your course email settings
<a
href=
"https://${settings.SITE_NAME}${reverse('dashboard')}"
>
here
</a>
.
<br
/>
lms/templates/emails/email_footer.txt
View file @
12990a99
<%! from django.core.urlresolvers import reverse %>
----
This email was automatically sent from ${settings.PLATFORM_NAME}
to ${name}
.
This email was automatically sent from ${settings.PLATFORM_NAME}.
You are receiving this email at address ${ email } because you are enrolled in ${ course_title }
(URL: ${course_url} ).
To stop receiving email like this, update your account settings at https://${settings.SITE_NAME}${reverse('dashboard')}.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment