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
cf16975b
Commit
cf16975b
authored
Jun 19, 2014
by
Abdallah
Committed by
Ned Batchelder
Jul 10, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
unicode fixes
parent
e8d264f8
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
10 deletions
+10
-10
cms/djangoapps/contentstore/views/import_export.py
+3
-3
common/lib/xmodule/xmodule/modulestore/xml.py
+5
-5
lms/djangoapps/instructor/views/api.py
+1
-1
lms/djangoapps/instructor/views/legacy.py
+1
-1
No files found.
cms/djangoapps/contentstore/views/import_export.py
View file @
cf16975b
...
...
@@ -324,11 +324,11 @@ def export_handler(request, course_key_string):
try
:
export_to_xml
(
modulestore
(),
contentstore
(),
course_module
.
id
,
root_dir
,
name
)
logging
.
debug
(
'tar file being generated at {0}'
.
format
(
export_file
.
name
))
logging
.
debug
(
u
'tar file being generated at {0}'
.
format
(
export_file
.
name
))
with
tarfile
.
open
(
name
=
export_file
.
name
,
mode
=
'w:gz'
)
as
tar_file
:
tar_file
.
add
(
root_dir
/
name
,
arcname
=
name
)
except
SerializationError
as
exc
:
log
.
exception
(
'There was an error exporting course
%
s'
,
course_module
.
id
)
log
.
exception
(
u
'There was an error exporting course
%
s'
,
course_module
.
id
)
unit
=
None
failed_item
=
None
parent
=
None
...
...
@@ -369,7 +369,7 @@ def export_handler(request, course_key_string):
wrapper
=
FileWrapper
(
export_file
)
response
=
HttpResponse
(
wrapper
,
content_type
=
'application/x-tgz'
)
response
[
'Content-Disposition'
]
=
'attachment; filename=
%
s'
%
os
.
path
.
basename
(
export_file
.
name
)
response
[
'Content-Disposition'
]
=
'attachment; filename=
%
s'
%
os
.
path
.
basename
(
unicode
(
export_file
.
name
)
.
encode
(
'utf-8'
)
)
response
[
'Content-Length'
]
=
os
.
path
.
getsize
(
export_file
.
name
)
return
response
...
...
common/lib/xmodule/xmodule/modulestore/xml.py
View file @
cf16975b
...
...
@@ -128,9 +128,9 @@ class ImportSystem(XMLParsingSystem, MakoDescriptorSystem):
# put it in the error tracker--content folks need to see it.
if
tag
in
need_uniq_names
:
error_tracker
(
"PROBLEM: no name of any kind specified for {tag}. Student "
"state will not be properly tracked for this module. Problem xml:"
" '{xml}...'"
.
format
(
tag
=
tag
,
xml
=
xml
[:
100
]))
error_tracker
(
u
"PROBLEM: no name of any kind specified for {tag}. Student "
u
"state will not be properly tracked for this module. Problem xml:"
u
" '{xml}...'"
.
format
(
tag
=
tag
,
xml
=
xml
[:
100
]))
else
:
# TODO (vshnayder): We may want to enable this once course repos are cleaned up.
# (or we may want to give up on the requirement for non-state-relevant issues...)
...
...
@@ -143,8 +143,8 @@ class ImportSystem(XMLParsingSystem, MakoDescriptorSystem):
# doesn't store state, don't complain about things that are
# hashed.
if
tag
in
need_uniq_names
:
msg
=
(
"Non-unique url_name in xml. This may break state tracking for content."
" url_name={0}. Content={1}"
.
format
(
url_name
,
xml
[:
100
]))
msg
=
(
u
"Non-unique url_name in xml. This may break state tracking for content."
u
" url_name={0}. Content={1}"
.
format
(
url_name
,
xml
[:
100
]))
error_tracker
(
"PROBLEM: "
+
msg
)
log
.
warning
(
msg
)
# Just set name to fallback_name--if there are multiple things with the same fallback name,
...
...
lms/djangoapps/instructor/views/api.py
View file @
cf16975b
...
...
@@ -616,7 +616,7 @@ def get_anon_ids(request, course_id): # pylint: disable=W0613
def
csv_response
(
filename
,
header
,
rows
):
"""Returns a CSV http response for the given header and rows (excel/utf-8)."""
response
=
HttpResponse
(
mimetype
=
'text/csv'
)
response
[
'Content-Disposition'
]
=
'attachment; filename={0}'
.
format
(
filename
)
response
[
'Content-Disposition'
]
=
'attachment; filename={0}'
.
format
(
unicode
(
filename
)
.
encode
(
'utf-8'
)
)
writer
=
csv
.
writer
(
response
,
dialect
=
'excel'
,
quotechar
=
'"'
,
quoting
=
csv
.
QUOTE_ALL
)
# In practice, there should not be non-ascii data in this query,
# but trying to do the right thing anyway.
...
...
lms/djangoapps/instructor/views/legacy.py
View file @
cf16975b
...
...
@@ -152,7 +152,7 @@ def instructor_dashboard(request, course_id):
"""Outputs a CSV file from the contents of a datatable."""
if
file_pointer
is
None
:
response
=
HttpResponse
(
mimetype
=
'text/csv'
)
response
[
'Content-Disposition'
]
=
'attachment; filename={0}'
.
format
(
func
)
response
[
'Content-Disposition'
]
=
(
u'attachment; filename={0}'
.
format
(
func
))
.
encode
(
'utf-8'
)
else
:
response
=
file_pointer
writer
=
csv
.
writer
(
response
,
dialect
=
'excel'
,
quotechar
=
'"'
,
quoting
=
csv
.
QUOTE_ALL
)
...
...
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