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
5e8e31b2
Commit
5e8e31b2
authored
Apr 01, 2013
by
Ned Batchelder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a cache attribute to ModuleSystem
parent
ceb6ceda
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
1 deletions
+19
-1
common/lib/xmodule/xmodule/x_module.py
+19
-1
No files found.
common/lib/xmodule/xmodule/x_module.py
View file @
5e8e31b2
...
...
@@ -700,7 +700,9 @@ class ModuleSystem(object):
anonymous_student_id
=
''
,
course_id
=
None
,
open_ended_grading_interface
=
None
,
s3_interface
=
None
):
s3_interface
=
None
,
cache
=
None
,
):
'''
Create a closure around the system environment.
...
...
@@ -742,6 +744,11 @@ class ModuleSystem(object):
xblock_model_data - A dict-like object containing the all data available to this
xblock
cache - A cache object with two methods:
.get(key) returns an object from the cache or None.
.set(key, value, timeout_secs=None) stores a value in the cache with a timeout.
'''
self
.
ajax_url
=
ajax_url
self
.
xqueue
=
xqueue
...
...
@@ -766,6 +773,8 @@ class ModuleSystem(object):
self
.
open_ended_grading_interface
=
open_ended_grading_interface
self
.
s3_interface
=
s3_interface
self
.
cache
=
cache
or
DoNothingCache
()
def
get
(
self
,
attr
):
''' provide uniform access to attributes (like etree).'''
return
self
.
__dict__
.
get
(
attr
)
...
...
@@ -779,3 +788,12 @@ class ModuleSystem(object):
def
__str__
(
self
):
return
str
(
self
.
__dict__
)
class
DoNothingCache
(
object
):
"""A duck-compatible object to use in ModuleSystem when there's no cache."""
def
get
(
self
,
key
):
return
None
def
set
(
self
,
key
,
value
,
timeout
=
None
):
pass
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