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
7b89b1eb
Commit
7b89b1eb
authored
Jun 29, 2012
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add ability to update modulestore metadata for a module separately from data or children
parent
51a79017
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
2 deletions
+39
-2
cms/djangoapps/contentstore/management/commands/import.py
+1
-0
common/lib/keystore/__init__.py
+11
-1
common/lib/keystore/mongo.py
+17
-1
common/lib/keystore/xml.py
+10
-0
No files found.
cms/djangoapps/contentstore/management/commands/import.py
View file @
7b89b1eb
...
@@ -26,3 +26,4 @@ class Command(BaseCommand):
...
@@ -26,3 +26,4 @@ class Command(BaseCommand):
keystore
()
.
update_item
(
module
.
location
,
module
.
definition
[
'data'
])
keystore
()
.
update_item
(
module
.
location
,
module
.
definition
[
'data'
])
if
'children'
in
module
.
definition
:
if
'children'
in
module
.
definition
:
keystore
()
.
update_children
(
module
.
location
,
module
.
definition
[
'children'
])
keystore
()
.
update_children
(
module
.
location
,
module
.
definition
[
'children'
])
keystore
()
.
update_metadata
(
module
.
url
,
module
.
metadata
)
common/lib/keystore/__init__.py
View file @
7b89b1eb
...
@@ -171,9 +171,19 @@ class ModuleStore(object):
...
@@ -171,9 +171,19 @@ class ModuleStore(object):
def
update_children
(
self
,
location
,
children
):
def
update_children
(
self
,
location
,
children
):
"""
"""
Set the children for the item specified by the location to
Set the children for the item specified by the location to
data
children
location: Something that can be passed to Location
location: Something that can be passed to Location
children: A list of child item identifiers
children: A list of child item identifiers
"""
"""
raise
NotImplementedError
raise
NotImplementedError
def
update_metadata
(
self
,
location
,
metadata
):
"""
Set the metadata for the item specified by the location to
metadata
location: Something that can be passed to Location
metadata: A nested dictionary of module metadata
"""
raise
NotImplementedError
common/lib/keystore/mongo.py
View file @
7b89b1eb
...
@@ -85,7 +85,7 @@ class MongoModuleStore(ModuleStore):
...
@@ -85,7 +85,7 @@ class MongoModuleStore(ModuleStore):
def
update_children
(
self
,
location
,
children
):
def
update_children
(
self
,
location
,
children
):
"""
"""
Set the children for the item specified by the location to
Set the children for the item specified by the location to
data
children
location: Something that can be passed to Location
location: Something that can be passed to Location
children: A list of child item identifiers
children: A list of child item identifiers
...
@@ -97,3 +97,19 @@ class MongoModuleStore(ModuleStore):
...
@@ -97,3 +97,19 @@ class MongoModuleStore(ModuleStore):
{
'location'
:
Location
(
location
)
.
dict
()},
{
'location'
:
Location
(
location
)
.
dict
()},
{
'$set'
:
{
'definition.children'
:
children
}}
{
'$set'
:
{
'definition.children'
:
children
}}
)
)
def
update_metadata
(
self
,
location
,
metadata
):
"""
Set the children for the item specified by the location to
metadata
location: Something that can be passed to Location
metadata: A nested dictionary of module metadata
"""
# See http://www.mongodb.org/display/DOCS/Updating for
# atomic update syntax
self
.
collection
.
update
(
{
'location'
:
Location
(
location
)
.
dict
()},
{
'$set'
:
{
'metadata'
:
metadata
}}
)
common/lib/keystore/xml.py
View file @
7b89b1eb
...
@@ -94,3 +94,13 @@ class XMLModuleStore(ModuleStore):
...
@@ -94,3 +94,13 @@ class XMLModuleStore(ModuleStore):
children: A list of child item identifiers
children: A list of child item identifiers
"""
"""
raise
NotImplementedError
(
"XMLModuleStores are read-only"
)
raise
NotImplementedError
(
"XMLModuleStores are read-only"
)
def
update_metadata
(
self
,
location
,
metadata
):
"""
Set the metadata for the item specified by the location to
metadata
location: Something that can be passed to Location
metadata: A nested dictionary of module metadata
"""
raise
NotImplementedError
(
"XMLModuleStores are read-only"
)
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