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
f7ff8f8b
Commit
f7ff8f8b
authored
Oct 10, 2013
by
Carlos Andrés Rocha
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Delete dump_course_structure django command on cms
Replaced by dump_course_structure on lms
parent
7852b107
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
62 deletions
+0
-62
cms/djangoapps/contentstore/management/commands/dump_course_structure.py
+0
-62
No files found.
cms/djangoapps/contentstore/management/commands/dump_course_structure.py
deleted
100644 → 0
View file @
7852b107
"""
Script for dumping course dumping the course structure
"""
from
django.core.management.base
import
BaseCommand
,
CommandError
from
xmodule.course_module
import
CourseDescriptor
from
xmodule.modulestore.django
import
modulestore
from
json
import
dumps
from
xmodule.modulestore.inheritance
import
own_metadata
from
django.conf
import
settings
filter_list
=
[
'xml_attributes'
,
'checklists'
]
class
Command
(
BaseCommand
):
"""
The Django command for dumping course structure
"""
help
=
'''Write out to stdout a structural and metadata information about a course in a flat dictionary serialized
in a JSON format. This can be used for analytics.'''
def
handle
(
self
,
*
args
,
**
options
):
"Execute the command"
if
len
(
args
)
<
2
or
len
(
args
)
>
3
:
raise
CommandError
(
"dump_course_structure requires two or more arguments: <location> <outfile> |<db>|"
)
course_id
=
args
[
0
]
outfile
=
args
[
1
]
# use a user-specified database name, if present
# this is useful for doing dumps from databases restored from prod backups
if
len
(
args
)
==
3
:
settings
.
MODULESTORE
[
'direct'
][
'OPTIONS'
][
'db'
]
=
args
[
2
]
loc
=
CourseDescriptor
.
id_to_location
(
course_id
)
store
=
modulestore
()
course
=
None
try
:
course
=
store
.
get_item
(
loc
,
depth
=
4
)
except
:
print
(
'Could not find course at {0}'
.
format
(
course_id
))
return
info
=
{}
def
dump_into_dict
(
module
,
info
):
filtered_metadata
=
dict
((
key
,
value
)
for
key
,
value
in
own_metadata
(
module
)
.
iteritems
()
if
key
not
in
filter_list
)
info
[
module
.
location
.
url
()]
=
{
'category'
:
module
.
location
.
category
,
'children'
:
module
.
children
if
hasattr
(
module
,
'children'
)
else
[],
'metadata'
:
filtered_metadata
}
for
child
in
module
.
get_children
():
dump_into_dict
(
child
,
info
)
dump_into_dict
(
course
,
info
)
with
open
(
outfile
,
'w'
)
as
f
:
f
.
write
(
dumps
(
info
))
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