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
13dc390f
Commit
13dc390f
authored
Apr 30, 2015
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use a specialized method to clean up DjangoKeyValueStore
parent
7d2909c5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
10 deletions
+8
-10
lms/djangoapps/courseware/model_data.py
+8
-10
No files found.
lms/djangoapps/courseware/model_data.py
View file @
13dc390f
...
...
@@ -95,9 +95,7 @@ class DjangoKeyValueStore(KeyValueStore):
self
.
_field_data_cache
=
field_data_cache
def
get
(
self
,
key
):
if
key
.
scope
not
in
self
.
_allowed_scopes
:
raise
InvalidScopeError
(
key
)
self
.
_raise_unless_scope_is_allowed
(
key
)
return
self
.
_field_data_cache
.
get
(
key
)
def
set
(
self
,
key
,
value
):
...
...
@@ -116,23 +114,23 @@ class DjangoKeyValueStore(KeyValueStore):
"""
for
key
in
kv_dict
:
# Check key for validity
if
key
.
scope
not
in
self
.
_allowed_scopes
:
raise
InvalidScopeError
(
key
)
self
.
_raise_unless_scope_is_allowed
(
key
)
self
.
_field_data_cache
.
set_many
(
kv_dict
)
def
delete
(
self
,
key
):
if
key
.
scope
not
in
self
.
_allowed_scopes
:
raise
InvalidScopeError
(
key
)
self
.
_raise_unless_scope_is_allowed
(
key
)
self
.
_field_data_cache
.
delete
(
key
)
def
has
(
self
,
key
):
self
.
_raise_unless_scope_is_allowed
(
key
)
return
self
.
_field_data_cache
.
has
(
key
)
def
_raise_unless_scope_is_allowed
(
self
,
key
):
"""Raise an InvalidScopeError if key.scope is not in self._allowed_scopes."""
if
key
.
scope
not
in
self
.
_allowed_scopes
:
raise
InvalidScopeError
(
key
)
return
self
.
_field_data_cache
.
has
(
key
)
new_contract
(
"DjangoKeyValueStore"
,
DjangoKeyValueStore
)
new_contract
(
"DjangoKeyValueStore_Key"
,
DjangoKeyValueStore
.
Key
)
...
...
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