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
7e1ca6e3
Commit
7e1ca6e3
authored
Oct 08, 2012
by
Victor Shnayder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pass course_id instead of course to get_site_status_msg
* makes testing easier -- don't need course objects
parent
3feb24f9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
14 deletions
+11
-14
common/djangoapps/status/status.py
+3
-3
common/djangoapps/status/tests.py
+5
-8
lms/templates/navigation.html
+3
-3
No files found.
common/djangoapps/status/status.py
View file @
7e1ca6e3
...
...
@@ -10,7 +10,7 @@ import sys
log
=
logging
.
getLogger
(
__name__
)
def
get_site_status_msg
(
course
):
def
get_site_status_msg
(
course
_id
):
"""
Look for a file settings.STATUS_MESSAGE_PATH. If found, read it,
parse as json, and do the following:
...
...
@@ -33,9 +33,9 @@ def get_site_status_msg(course):
status_dict
=
json
.
loads
(
content
)
msg
=
status_dict
.
get
(
'global'
,
None
)
if
course
and
course
.
id
in
status_dict
:
if
course
_
id
in
status_dict
:
msg
=
msg
+
"<br>"
if
msg
else
''
msg
+=
status_dict
[
course
.
id
]
msg
+=
status_dict
[
course
_
id
]
return
msg
except
:
...
...
common/djangoapps/status/tests.py
View file @
7e1ca6e3
from
django.conf
import
settings
from
django.test
import
TestCase
from
mock
import
Mock
import
os
from
override_settings
import
override_settings
from
tempfile
import
NamedTemporaryFile
...
...
@@ -53,13 +52,11 @@ class TestStatus(TestCase):
def
setUp
(
self
):
"""
Mock course
s, since we don't have to have full django
Fake course id
s, since we don't have to have full django
settings (common tests run without the lms settings imported)
"""
self
.
full
=
Mock
()
self
.
full
.
id
=
'edX/full/2012_Fall'
self
.
toy
=
Mock
()
self
.
toy
.
id
=
'edX/toy/2012_Fall'
self
.
full_id
=
'edX/full/2012_Fall'
self
.
toy_id
=
'edX/toy/2012_Fall'
def
create_status_file
(
self
,
contents
):
"""
...
...
@@ -88,6 +85,6 @@ class TestStatus(TestCase):
print
"course=None:"
self
.
assertEqual
(
get_site_status_msg
(
None
),
exp_none
)
print
"course=toy:"
self
.
assertEqual
(
get_site_status_msg
(
self
.
toy
),
exp_toy
)
self
.
assertEqual
(
get_site_status_msg
(
self
.
toy
_id
),
exp_toy
)
print
"course=full:"
self
.
assertEqual
(
get_site_status_msg
(
self
.
full
),
exp_full
)
self
.
assertEqual
(
get_site_status_msg
(
self
.
full
_id
),
exp_full
)
lms/templates/navigation.html
View file @
7e1ca6e3
...
...
@@ -15,11 +15,11 @@ from status.status import get_site_status_msg
<
%
block
cached=
"False"
>
<
%
try:
c
=
course
c
ourse_id =
course.id
except:
#
can
'
t
figure
out
a
better
way
to
get
at
a
possibly-defined
course
var
c =
None
site_status_msg =
get_site_status_msg(c)
c
ourse_id
=
None
site_status_msg =
get_site_status_msg(c
ourse_id
)
%
>
% if site_status_msg:
<div
class=
"site-status"
>
...
...
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