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
f2c5dc8e
Commit
f2c5dc8e
authored
Oct 02, 2012
by
Victor Shnayder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
get rid of caching--unneeded complexity.
parent
883e71f6
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
14 deletions
+2
-14
common/djangoapps/status/status.py
+2
-14
No files found.
common/djangoapps/status/status.py
View file @
f2c5dc8e
...
...
@@ -14,28 +14,16 @@ log = logging.getLogger(__name__)
def
get_site_status_msg
():
"""
Look for a file settings.STATUS_MESSAGE_PATH. If found, return the
contents. Otherwise, return None.
Caches result for 10 seconds, per-machine.
contents. Otherwise, return None.
If something goes wrong, returns None. ("is there a status msg?" logic is
not allowed to break the entire site).
"""
cache_time
=
10
try
:
key
=
','
.
join
([
settings
.
HOSTNAME
,
settings
.
STATUS_MESSAGE_PATH
])
content
=
cache
.
get
(
key
)
if
content
==
''
:
# cached that there isn't a status message
return
None
if
content
is
None
:
# nothing in the cache, so check the filesystem
content
=
None
if
os
.
path
.
isfile
(
settings
.
STATUS_MESSAGE_PATH
):
with
open
(
settings
.
STATUS_MESSAGE_PATH
)
as
f
:
content
=
f
.
read
()
else
:
# remember that there isn't anything there
cache
.
set
(
key
,
''
,
cache_time
)
content
=
None
return
content
except
:
...
...
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