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
c9dbd2c3
Commit
c9dbd2c3
authored
Apr 24, 2015
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add an empty implementation of XBlockUserStateClient backed by StudentModule
parent
57d5fa28
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
64 additions
and
0 deletions
+64
-0
lms/djangoapps/courseware/user_state_client.py
+63
-0
lms/djangoapps/xblock_user_state/interface.py
+1
-0
No files found.
lms/djangoapps/courseware/user_state_client.py
0 → 100644
View file @
c9dbd2c3
"""
An implementation of :class:`XBlockUserStateClient`, which stores XBlock Scope.user_state
data in a Django ORM model.
"""
from
xblock_user_state.interface
import
DjangoXBlockUserStateClient
class
DjangoXBlockUserStateClient
(
DjangoXBlockUserStateClient
):
"""
An interface that uses the Django ORM StudentModule as a backend.
"""
class
ServiceUnavailable
(
XBlockUserStateClient
.
ServiceUnavailable
):
"""
This error is raised if the service backing this client is currently unavailable.
"""
pass
class
PermissionDenied
(
XBlockUserStateClient
.
PermissionDenied
):
"""
This error is raised if the caller is not allowed to access the requested data.
"""
pass
class
DoesNotExist
(
XBlockUserStateClient
.
DoesNotExist
):
"""
This error is raised if the caller has requested data that does not exist.
"""
pass
def
get
(
username
,
block_key
,
scope
=
Scope
.
user_state
):
return
self
.
get_many
(
username
,
[
block_key
],
scope
)
def
set
(
username
,
block_key
,
state
,
scope
=
Scope
.
user_state
):
self
.
set_many
(
username
,
{
block_key
:
state
},
scope
)
def
get_many
(
username
,
block_keys
,
scope
=
Scope
.
user_state
):
"""Returns dict of block_id -> state."""
raise
NotImplementedError
()
def
set_many
(
username
,
block_keys_to_state
,
scope
=
Scope
.
user_state
):
raise
NotImplementedError
()
def
get_history
(
username
,
block_key
,
scope
=
Scope
.
user_state
):
"""We don't guarantee that history for many blocks will be fast."""
raise
NotImplementedError
()
def
iter_all_for_block
(
block_key
,
scope
=
Scope
.
user_state
,
batch_size
=
None
):
"""
You get no ordering guarantees. Fetching will happen in batch_size
increments. If you're using this method, you should be running in an
async task.
"""
raise
NotImplementedError
()
def
iter_all_for_course
(
course_key
,
block_type
=
None
,
scope
=
Scope
.
user_state
,
batch_size
=
None
):
"""
You get no ordering guarantees. Fetching will happen in batch_size
increments. If you're using this method, you should be running in an
async task.
"""
raise
NotImplementedError
()
lms/djangoapps/xblock_user_state/interface.py
View file @
c9dbd2c3
...
...
@@ -10,6 +10,7 @@ from xblock.fields import Scope, ScopeBase
new_contract
(
'UsageKey'
,
UsageKey
)
class
XBlockUserStateClient
(
object
):
"""
First stab at an interface for accessing XBlock User State. This will have
...
...
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