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
d6efd128
Commit
d6efd128
authored
Feb 17, 2015
by
Waqas Khalid
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6996 from edx/waqas/tnl1390-missing-discussion-blackout
Missing discussion blackout throwing exception
parents
4dd9cd2c
a730f811
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
2 deletions
+6
-2
cms/djangoapps/contentstore/tests/tests.py
+4
-0
common/lib/xmodule/xmodule/course_module.py
+2
-2
No files found.
cms/djangoapps/contentstore/tests/tests.py
View file @
d6efd128
...
...
@@ -319,6 +319,10 @@ class ForumTestCase(CourseTestCase):
self
.
course
.
discussion_blackouts
=
[(
t
.
isoformat
(),
t2
.
isoformat
())
for
t
,
t2
in
times2
]
self
.
assertFalse
(
self
.
course
.
forum_posts_allowed
)
# test if user gives empty blackout date it should return true for forum_posts_allowed
self
.
course
.
discussion_blackouts
=
[[]]
self
.
assertTrue
(
self
.
course
.
forum_posts_allowed
)
@ddt
class
CourseKeyVerificationTestCase
(
CourseTestCase
):
...
...
common/lib/xmodule/xmodule/course_module.py
View file @
d6efd128
...
...
@@ -1294,13 +1294,13 @@ class CourseDescriptor(CourseFields, SequenceDescriptor):
blackout_periods
=
[(
date_proxy
.
from_json
(
start
),
date_proxy
.
from_json
(
end
))
for
start
,
end
in
self
.
discussion_blackouts
]
in
filter
(
None
,
self
.
discussion_blackouts
)
]
now
=
datetime
.
now
(
UTC
())
for
start
,
end
in
blackout_periods
:
if
start
<=
now
<=
end
:
return
False
except
:
log
.
exception
(
"Error parsing discussion_blackouts
for course {0}"
.
format
(
self
.
id
)
)
log
.
exception
(
"Error parsing discussion_blackouts
%
s for course
%
s"
,
self
.
discussion_blackouts
,
self
.
id
)
return
True
...
...
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