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
64df5cc0
Commit
64df5cc0
authored
Jan 14, 2013
by
Calen Pennington
Committed by
cahrens
Jan 14, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make errors during course loading not break the site, but just hide that course instead
parent
51868aad
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
common/lib/xmodule/xmodule/modulestore/xml.py
+6
-3
No files found.
common/lib/xmodule/xmodule/modulestore/xml.py
View file @
64df5cc0
...
@@ -13,6 +13,7 @@ from importlib import import_module
...
@@ -13,6 +13,7 @@ from importlib import import_module
from
lxml
import
etree
from
lxml
import
etree
from
path
import
path
from
path
import
path
from
xmodule.error_module
import
ErrorDescriptor
from
xmodule.errortracker
import
make_error_tracker
,
exc_info_to_str
from
xmodule.errortracker
import
make_error_tracker
,
exc_info_to_str
from
xmodule.course_module
import
CourseDescriptor
from
xmodule.course_module
import
CourseDescriptor
from
xmodule.mako_module
import
MakoDescriptorSystem
from
xmodule.mako_module
import
MakoDescriptorSystem
...
@@ -167,8 +168,6 @@ class ImportSystem(XMLParsingSystem, MakoDescriptorSystem):
...
@@ -167,8 +168,6 @@ class ImportSystem(XMLParsingSystem, MakoDescriptorSystem):
# Didn't load properly. Fall back on loading as an error
# Didn't load properly. Fall back on loading as an error
# descriptor. This should never error due to formatting.
# descriptor. This should never error due to formatting.
# Put import here to avoid circular import errors
from
xmodule.error_module
import
ErrorDescriptor
msg
=
"Error loading from xml. "
+
str
(
err
)[:
200
]
msg
=
"Error loading from xml. "
+
str
(
err
)[:
200
]
log
.
warning
(
msg
)
log
.
warning
(
msg
)
...
@@ -311,7 +310,7 @@ class XMLModuleStore(ModuleStoreBase):
...
@@ -311,7 +310,7 @@ class XMLModuleStore(ModuleStoreBase):
log
.
exception
(
msg
)
log
.
exception
(
msg
)
errorlog
.
tracker
(
msg
)
errorlog
.
tracker
(
msg
)
if
course_descriptor
is
not
None
:
if
course_descriptor
is
not
None
and
not
isinstance
(
course_descriptor
,
ErrorDescriptor
)
:
self
.
courses
[
course_dir
]
=
course_descriptor
self
.
courses
[
course_dir
]
=
course_descriptor
self
.
_location_errors
[
course_descriptor
.
location
]
=
errorlog
self
.
_location_errors
[
course_descriptor
.
location
]
=
errorlog
self
.
parent_trackers
[
course_descriptor
.
id
]
.
make_known
(
course_descriptor
.
location
)
self
.
parent_trackers
[
course_descriptor
.
id
]
.
make_known
(
course_descriptor
.
location
)
...
@@ -423,6 +422,10 @@ class XMLModuleStore(ModuleStoreBase):
...
@@ -423,6 +422,10 @@ class XMLModuleStore(ModuleStoreBase):
course_descriptor
=
system
.
process_xml
(
etree
.
tostring
(
course_data
,
encoding
=
'unicode'
))
course_descriptor
=
system
.
process_xml
(
etree
.
tostring
(
course_data
,
encoding
=
'unicode'
))
# If we fail to load the course, then skip the rest of the loading steps
if
isinstance
(
course_descriptor
,
ErrorDescriptor
):
return
course_descriptor
# NOTE: The descriptors end up loading somewhat bottom up, which
# NOTE: The descriptors end up loading somewhat bottom up, which
# breaks metadata inheritance via get_children(). Instead
# breaks metadata inheritance via get_children(). Instead
# (actually, in addition to, for now), we do a final inheritance pass
# (actually, in addition to, for now), we do a final inheritance pass
...
...
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