Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
notifier
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
notifier
Commits
03e2a618
Unverified
Commit
03e2a618
authored
Nov 07, 2017
by
Alex Dusenbery
Committed by
GitHub
Nov 07, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #49 from edx/aed/really-safe-language-code
Really, really, really make sure we have a LANGUAGE_CODE.
parents
18594915
75842660
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletions
+4
-1
notifier/tasks.py
+4
-1
No files found.
notifier/tasks.py
View file @
03e2a618
...
@@ -21,6 +21,9 @@ from notifier.user import get_digest_subscribers, UserServiceException
...
@@ -21,6 +21,9 @@ from notifier.user import get_digest_subscribers, UserServiceException
logger
=
logging
.
getLogger
(
__name__
)
logger
=
logging
.
getLogger
(
__name__
)
DEFAULT_LANGUAGE
=
'en'
@celery.task
(
rate_limit
=
settings
.
FORUM_DIGEST_TASK_RATE_LIMIT
,
max_retries
=
settings
.
FORUM_DIGEST_TASK_MAX_RETRIES
)
@celery.task
(
rate_limit
=
settings
.
FORUM_DIGEST_TASK_RATE_LIMIT
,
max_retries
=
settings
.
FORUM_DIGEST_TASK_MAX_RETRIES
)
def
generate_and_send_digests
(
users
,
from_dt
,
to_dt
,
language
=
None
):
def
generate_and_send_digests
(
users
,
from_dt
,
to_dt
,
language
=
None
):
"""
"""
...
@@ -33,7 +36,7 @@ def generate_and_send_digests(users, from_dt, to_dt, language=None):
...
@@ -33,7 +36,7 @@ def generate_and_send_digests(users, from_dt, to_dt, language=None):
`from_dt` and `to_dt` are datetime objects representing the start and end
`from_dt` and `to_dt` are datetime objects representing the start and end
of the time window for which to generate a digest.
of the time window for which to generate a digest.
"""
"""
settings
.
LANGUAGE_CODE
=
language
or
settings
.
LANGUAGE_CODE
settings
.
LANGUAGE_CODE
=
language
or
settings
.
LANGUAGE_CODE
or
DEFAULT_LANGUAGE
users_by_id
=
dict
((
str
(
u
[
'id'
]),
u
)
for
u
in
users
)
users_by_id
=
dict
((
str
(
u
[
'id'
]),
u
)
for
u
in
users
)
msgs
=
[]
msgs
=
[]
try
:
try
:
...
...
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