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
d54b197d
Commit
d54b197d
authored
Sep 04, 2013
by
Julian Arni
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix unicode errors on exceptions and logging
parent
1cfad39f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
5 deletions
+7
-5
common/lib/xmodule/xmodule/modulestore/xml.py
+6
-4
common/lib/xmodule/xmodule/modulestore/xml_importer.py
+1
-1
No files found.
common/lib/xmodule/xmodule/modulestore/xml.py
View file @
d54b197d
...
...
@@ -173,7 +173,7 @@ class ImportSystem(XMLParsingSystem, MakoDescriptorSystem):
# Didn't load properly. Fall back on loading as an error
# descriptor. This should never error due to formatting.
msg
=
"Error loading from xml. "
+
str
(
err
)[:
200
]
msg
=
"Error loading from xml. "
+
unicode
(
err
)[:
200
]
log
.
warning
(
msg
)
# Normally, we don't want lots of exception traces in our logs from common
# content problems. But if you're debugging the xml loading code itself,
...
...
@@ -317,7 +317,8 @@ class XMLModuleStore(ModuleStoreBase):
try
:
course_descriptor
=
self
.
load_course
(
course_dir
,
errorlog
.
tracker
)
except
Exception
as
e
:
msg
=
"ERROR: Failed to load course '{0}': {1}"
.
format
(
course_dir
,
str
(
e
))
msg
=
"ERROR: Failed to load course '{0}': {1}"
.
format
(
course_dir
.
encode
(
"utf-8"
),
unicode
(
e
))
log
.
exception
(
msg
)
errorlog
.
tracker
(
msg
)
...
...
@@ -493,8 +494,9 @@ class XMLModuleStore(ModuleStoreBase):
module
.
save
()
self
.
modules
[
course_descriptor
.
id
][
module
.
location
]
=
module
except
Exception
,
e
:
logging
.
exception
(
"Failed to load {0}. Skipping... Exception: {1}"
.
format
(
filepath
,
str
(
e
)))
system
.
error_tracker
(
"ERROR: "
+
str
(
e
))
logging
.
exception
(
"Failed to load
%
s. Skipping...
\
Exception:
%
s"
,
filepath
,
unicode
(
e
))
system
.
error_tracker
(
"ERROR: "
+
unicode
(
e
))
def
get_instance
(
self
,
course_id
,
location
,
depth
=
0
):
"""
...
...
common/lib/xmodule/xmodule/modulestore/xml_importer.py
View file @
d54b197d
...
...
@@ -31,7 +31,7 @@ def import_static_content(modules, course_loc, course_data_path, static_content_
try
:
content_path
=
os
.
path
.
join
(
dirname
,
filename
)
if
verbose
:
log
.
debug
(
'importing static content
{0}...'
.
format
(
content_path
.
encode
(
"utf-8"
)
))
log
.
debug
(
'importing static content
%
s...'
,
content_path
.
encode
(
"utf-8"
))
fullname_with_subpath
=
content_path
.
replace
(
static_dir
,
''
)
# strip away leading path from the name
if
fullname_with_subpath
.
startswith
(
'/'
):
...
...
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