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
8949c5e6
Commit
8949c5e6
authored
Mar 15, 2012
by
David Ormsbee
Browse files
Options
Browse Files
Download
Plain Diff
merged in session cache separation
parents
11f48207
d9253a0c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
6 deletions
+28
-6
courseware/content_parser.py
+3
-5
settings.py
+7
-0
simplewiki/models.py
+2
-1
util/cache.py
+16
-0
No files found.
courseware/content_parser.py
View file @
8949c5e6
...
@@ -11,10 +11,11 @@ from lxml import etree
...
@@ -11,10 +11,11 @@ from lxml import etree
try
:
# This lets us do __name__ == ='__main__'
try
:
# This lets us do __name__ == ='__main__'
from
django.conf
import
settings
from
django.conf
import
settings
from
django.core.cache
import
cache
from
student.models
import
UserProfile
from
student.models
import
UserProfile
from
student.models
import
UserTestGroup
from
student.models
import
UserTestGroup
from
mitxmako.shortcuts
import
render_to_response
,
render_to_string
from
mitxmako.shortcuts
import
render_to_response
,
render_to_string
from
util.cache
import
cache
except
:
except
:
settings
=
None
settings
=
None
...
@@ -157,10 +158,7 @@ def user_groups(user):
...
@@ -157,10 +158,7 @@ def user_groups(user):
cache_expiration
=
60
*
60
# one hour
cache_expiration
=
60
*
60
# one hour
# Kill caching on dev machines -- we switch groups a lot
# Kill caching on dev machines -- we switch groups a lot
if
"dev"
not
in
settings
.
DEFAULT_GROUPS
:
group_names
=
cache
.
get
(
fasthash
(
key
))
group_names
=
cache
.
get
(
fasthash
(
key
))
else
:
group_names
=
None
if
group_names
is
None
:
if
group_names
is
None
:
group_names
=
[
u
.
name
for
u
in
UserTestGroup
.
objects
.
filter
(
users
=
user
)]
group_names
=
[
u
.
name
for
u
in
UserTestGroup
.
objects
.
filter
(
users
=
user
)]
...
...
settings.py
View file @
8949c5e6
...
@@ -163,6 +163,13 @@ MAKO_TEMPLATES = {}
...
@@ -163,6 +163,13 @@ MAKO_TEMPLATES = {}
LOGGING_ENV
=
"dev"
# override this in different environments
LOGGING_ENV
=
"dev"
# override this in different environments
# Default dev cache (i.e. no caching)
CACHES
=
{
'default'
:
{
'BACKEND'
:
'django.core.cache.backends.dummy.DummyCache'
,
}
}
# Make sure we execute correctly regardless of where we're called from
# Make sure we execute correctly regardless of where we're called from
execfile
(
os
.
path
.
join
(
BASE_DIR
,
"settings.py"
))
execfile
(
os
.
path
.
join
(
BASE_DIR
,
"settings.py"
))
...
...
simplewiki/models.py
View file @
8949c5e6
...
@@ -3,7 +3,6 @@ import os
...
@@ -3,7 +3,6 @@ import os
from
django
import
forms
from
django
import
forms
from
django.contrib.auth.models
import
User
from
django.contrib.auth.models
import
User
from
django.core.cache
import
cache
from
django.core.urlresolvers
import
reverse
from
django.core.urlresolvers
import
reverse
from
django.db
import
models
from
django.db
import
models
from
django.db.models
import
signals
from
django.db.models
import
signals
...
@@ -11,6 +10,8 @@ from django.utils.translation import ugettext_lazy as _
...
@@ -11,6 +10,8 @@ from django.utils.translation import ugettext_lazy as _
from
markdown
import
markdown
from
markdown
import
markdown
from
settings
import
*
from
settings
import
*
from
util.cache
import
cache
class
ShouldHaveExactlyOneRootSlug
(
Exception
):
class
ShouldHaveExactlyOneRootSlug
(
Exception
):
pass
pass
...
...
util/cache.py
0 → 100644
View file @
8949c5e6
"""
This module aims to give a little more fine-tuned control of caching and cache
invalidation. Import these instead of django.core.cache.
Note that 'default' is being preserved for user session caching, which we're
not migrating so as not to inconvenience users by logging them all out.
"""
from
django.core
import
cache
# If we can't find a 'general' CACHE defined in settings.py, we simply fall back
# to returning the default cache. This will happen with dev machines.
try
:
cache
=
cache
.
get_cache
(
'general'
)
except
ValueError
:
cache
=
cache
.
cache
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