Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
d0c99151
Commit
d0c99151
authored
12 years ago
by
Calen Pennington
Browse files
Options
Downloads
Patches
Plain Diff
Continue during backcompat imports by replacing contents with error xml
parent
7ae0836f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
common/lib/xmodule/xmodule/backcompat_module.py
+24
-21
24 additions, 21 deletions
common/lib/xmodule/xmodule/backcompat_module.py
with
24 additions
and
21 deletions
common/lib/xmodule/xmodule/backcompat_module.py
+
24
−
21
View file @
d0c99151
...
...
@@ -5,6 +5,7 @@ from x_module import XModuleDescriptor
from
lxml
import
etree
from
functools
import
wraps
import
logging
import
traceback
log
=
logging
.
getLogger
(
__name__
)
...
...
@@ -21,29 +22,31 @@ def process_includes(fn):
next_include
=
xml_object
.
find
(
'
include
'
)
while
next_include
is
not
None
:
file
=
next_include
.
get
(
'
file
'
)
if
file
is
not
None
:
try
:
ifp
=
system
.
resources_fs
.
open
(
file
)
except
Exception
:
msg
=
'
Error in problem xml include: %s
\n
'
%
(
etree
.
tostring
(
next_include
,
pretty_print
=
True
))
msg
+=
'
Cannot find file %s in %s
'
%
(
file
,
dir
)
log
.
exception
(
msg
)
system
.
error_handler
(
msg
)
raise
try
:
# read in and convert to XML
incxml
=
etree
.
XML
(
ifp
.
read
())
except
Exception
:
msg
=
'
Error in problem xml include: %s
\n
'
%
(
etree
.
tostring
(
next_include
,
pretty_print
=
True
))
msg
+=
'
Cannot parse XML in %s
'
%
(
file
)
log
.
exception
(
msg
)
system
.
error_handler
(
msg
)
raise
parent
=
next_include
.
getparent
()
if
file
is
None
:
continue
try
:
ifp
=
system
.
resources_fs
.
open
(
file
)
# read in and convert to XML
incxml
=
etree
.
XML
(
ifp
.
read
())
# insert new XML into tree in place of inlcude
parent
=
next_include
.
getparent
()
parent
.
insert
(
parent
.
index
(
next_include
),
incxml
)
except
Exception
:
msg
=
"
Error in problem xml include: %s
"
%
(
etree
.
tostring
(
next_include
,
pretty_print
=
True
))
log
.
exception
(
msg
)
parent
=
next_include
.
getparent
()
errorxml
=
etree
.
Element
(
'
error
'
)
messagexml
=
etree
.
SubElement
(
errorxml
,
'
message
'
)
messagexml
.
text
=
msg
stackxml
=
etree
.
SubElement
(
errorxml
,
'
stacktrace
'
)
stackxml
.
text
=
traceback
.
format_exc
()
# insert error XML in place of include
parent
.
insert
(
parent
.
index
(
next_include
),
errorxml
)
parent
.
remove
(
next_include
)
next_include
=
xml_object
.
find
(
'
include
'
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment