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
b779a421
Commit
b779a421
authored
Nov 14, 2012
by
Chris Dodge
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
check for the existence of static and static/subs directories
parent
1e598ad1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
3 deletions
+26
-3
common/lib/xmodule/xmodule/modulestore/xml_importer.py
+26
-3
No files found.
common/lib/xmodule/xmodule/modulestore/xml_importer.py
View file @
b779a421
...
...
@@ -111,7 +111,7 @@ def import_from_xml(store, data_dir, course_dirs=None,
)
if
validate_only
:
validate_module_structure
(
module_store
)
perform_xlint
(
data_dir
,
course_dirs
,
module_store
)
return
module_store
,
[]
# NOTE: the XmlModuleStore does not implement get_items() which would be a preferable means
...
...
@@ -224,11 +224,34 @@ def validate_category_hierarcy(module_store, course_id, parent_category, expecte
return
err_cnt
def
validate_module_structure
(
module_store
):
def
validate_data_source_path_existence
(
path
,
is_err
=
True
,
extra_msg
=
None
):
_cnt
=
0
if
not
os
.
path
.
exists
(
path
):
print
(
"{0}: Expected folder at {1}. {2}"
.
format
(
'ERROR'
if
is_err
==
True
else
'WARNING'
,
path
,
extra_msg
if
extra_msg
is
not
None
else
''
))
_cnt
=
1
return
_cnt
def
validate_data_source_paths
(
data_dir
,
course_dir
):
# check that there is a '/static/' directory
course_path
=
data_dir
/
course_dir
err_cnt
=
0
warn_cnt
=
0
err_cnt
+=
validate_data_source_path_existence
(
course_path
/
'static'
)
warn_cnt
+=
validate_data_source_path_existence
(
course_path
/
'static/subs'
,
is_err
=
False
,
extra_msg
=
'Video captions (if they are used) will not work unless they are static/subs.'
)
return
err_cnt
,
warn_cnt
print
module_store
.
errored_courses
def
perform_xlint
(
data_dir
,
course_dirs
,
module_store
):
err_cnt
=
0
warn_cnt
=
0
# check all data source path information
for
course_dir
in
course_dirs
:
_err_cnt
,
_warn_cnt
=
validate_data_source_paths
(
path
(
data_dir
),
course_dir
)
err_cnt
+=
_err_cnt
warn_cnt
+=
_warn_cnt
# first count all errors and warnings as part of the XMLModuleStore import
for
err_log
in
module_store
.
_location_errors
.
itervalues
():
...
...
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