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
2bbaaf6b
Commit
2bbaaf6b
authored
Sep 26, 2014
by
Greg Price
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix management commands more
parent
c9771a78
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
notifier/management/commands/forums_digest.py
+6
-6
No files found.
notifier/management/commands/forums_digest.py
View file @
2bbaaf6b
...
...
@@ -90,12 +90,14 @@ class Command(BaseCommand):
def
show_users
(
self
,
users
):
json
.
dump
(
list
(
users
),
self
.
stdout
)
def
show_content
(
self
,
users_by_id
,
from_dt
,
to_dt
):
def
show_content
(
self
,
users
,
from_dt
,
to_dt
):
users_by_id
=
dict
((
str
(
u
[
'id'
]),
u
)
for
u
in
users
)
all_content
=
generate_digest_content
(
users_by_id
,
from_dt
,
to_dt
)
# use django's encoder; builtin one doesn't handle datetime objects
json
.
dump
(
list
(
all_content
),
self
.
stdout
,
cls
=
DigestJSONEncoder
)
def
show_rendered
(
self
,
fmt
,
users_by_id
,
from_dt
,
to_dt
):
def
show_rendered
(
self
,
fmt
,
users
,
from_dt
,
to_dt
):
users_by_id
=
dict
((
str
(
u
[
'id'
]),
u
)
for
u
in
users
)
def
_fail
(
msg
):
logger
.
warning
(
'could not show rendered
%
s:
%
s'
,
fmt
,
msg
)
...
...
@@ -130,8 +132,6 @@ class Command(BaseCommand):
# get all the users subscribed to notifications
users
=
get_digest_subscribers
()
# generator
users_by_id
=
dict
((
str
(
u
[
'id'
]),
u
)
for
u
in
users
)
if
options
.
get
(
'show_users'
):
self
.
show_users
(
users
)
return
...
...
@@ -146,11 +146,11 @@ class Command(BaseCommand):
datetime
.
timedelta
(
minutes
=
options
[
'minutes'
])
if
options
.
get
(
'show_content'
):
self
.
show_content
(
users
_by_id
,
from_datetime
,
to_datetime
)
self
.
show_content
(
users
,
from_datetime
,
to_datetime
)
return
if
options
.
get
(
'show_text'
):
self
.
show_rendered
(
'text'
,
users
_by_id
,
from_datetime
,
to_datetime
)
self
.
show_rendered
(
'text'
,
users
,
from_datetime
,
to_datetime
)
return
if
options
.
get
(
'show_html'
):
...
...
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