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
eaa4b3ef
Commit
eaa4b3ef
authored
Aug 19, 2013
by
Julian Arni
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pep8 and pylint fixes
parent
d991595e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
20 deletions
+12
-20
cms/djangoapps/contentstore/tests/test_assets.py
+0
-5
cms/djangoapps/contentstore/views/assets.py
+0
-2
cms/djangoapps/contentstore/views/import_export.py
+12
-13
No files found.
cms/djangoapps/contentstore/tests/test_assets.py
View file @
eaa4b3ef
...
@@ -2,12 +2,7 @@
...
@@ -2,12 +2,7 @@
Unit tests for the asset upload endpoint.
Unit tests for the asset upload endpoint.
"""
"""
import
os
import
json
import
json
import
shutil
import
tarfile
import
tempfile
from
subprocess
import
call
from
datetime
import
datetime
from
datetime
import
datetime
from
io
import
BytesIO
from
io
import
BytesIO
from
pytz
import
UTC
from
pytz
import
UTC
...
...
cms/djangoapps/contentstore/views/assets.py
View file @
eaa4b3ef
...
@@ -38,8 +38,6 @@ from util.json_request import JsonResponse
...
@@ -38,8 +38,6 @@ from util.json_request import JsonResponse
__all__
=
[
'asset_index'
,
'upload_asset'
]
__all__
=
[
'asset_index'
,
'upload_asset'
]
MAX_UP_LENGTH
=
20000352
# Max chunk size
# Regex to capture Content-Range header ranges.
# Regex to capture Content-Range header ranges.
CONTENT_RE
=
re
.
compile
(
r"(?P<start>\d{1,11})-(?P<stop>\d{1,11})/(?P<end>\d{1,11})"
)
CONTENT_RE
=
re
.
compile
(
r"(?P<start>\d{1,11})-(?P<stop>\d{1,11})/(?P<end>\d{1,11})"
)
...
...
cms/djangoapps/contentstore/views/import_export.py
View file @
eaa4b3ef
...
@@ -63,7 +63,7 @@ def import_course(request, org, course, name):
...
@@ -63,7 +63,7 @@ def import_course(request, org, course, name):
filename
=
request
.
FILES
[
'course-data'
]
.
name
filename
=
request
.
FILES
[
'course-data'
]
.
name
if
not
filename
.
endswith
(
'.tar.gz'
):
if
not
filename
.
endswith
(
'.tar.gz'
):
return
JsonResponse
(
return
JsonResponse
(
{
'ErrMsg'
:
'We only support uploading a .tar.gz file.'
},
{
'ErrMsg'
:
'We only support uploading a .tar.gz file.'
},
status
=
415
status
=
415
)
)
temp_filepath
=
course_dir
/
filename
temp_filepath
=
course_dir
/
filename
...
@@ -96,11 +96,10 @@ def import_course(request, org, course, name):
...
@@ -96,11 +96,10 @@ def import_course(request, org, course, name):
content_range
[
'start'
]
content_range
[
'start'
]
)
)
return
JsonResponse
(
return
JsonResponse
(
{
'ErrMsg'
:
'File upload corrupted. Please try again'
},
{
'ErrMsg'
:
'File upload corrupted. Please try again'
},
status
=
409
status
=
409
)
)
with
open
(
temp_filepath
,
mode
)
as
temp_file
:
with
open
(
temp_filepath
,
mode
)
as
temp_file
:
for
chunk
in
request
.
FILES
[
'course-data'
]
.
chunks
():
for
chunk
in
request
.
FILES
[
'course-data'
]
.
chunks
():
temp_file
.
write
(
chunk
)
temp_file
.
write
(
chunk
)
...
@@ -121,8 +120,8 @@ def import_course(request, org, course, name):
...
@@ -121,8 +120,8 @@ def import_course(request, org, course, name):
'name'
:
location
.
name
'name'
:
location
.
name
}),
}),
"thumbnailUrl"
:
""
"thumbnailUrl"
:
""
}]
}]
})
})
else
:
# This was the last chunk.
else
:
# This was the last chunk.
...
@@ -167,7 +166,7 @@ def import_course(request, org, course, name):
...
@@ -167,7 +166,7 @@ def import_course(request, org, course, name):
if
not
dirpath
:
if
not
dirpath
:
return
JsonResponse
(
return
JsonResponse
(
{
'ErrMsg'
:
'Could not find the course.xml file in the package.'
},
{
'ErrMsg'
:
'Could not find the course.xml file in the package.'
},
status
=
415
status
=
415
)
)
...
@@ -178,13 +177,13 @@ def import_course(request, org, course, name):
...
@@ -178,13 +177,13 @@ def import_course(request, org, course, name):
shutil
.
move
(
dirpath
/
fname
,
course_dir
)
shutil
.
move
(
dirpath
/
fname
,
course_dir
)
_module_store
,
course_items
=
import_from_xml
(
_module_store
,
course_items
=
import_from_xml
(
modulestore
(
'direct'
),
modulestore
(
'direct'
),
settings
.
GITHUB_REPO_ROOT
,
settings
.
GITHUB_REPO_ROOT
,
[
course_subdir
],
[
course_subdir
],
load_error_modules
=
False
,
load_error_modules
=
False
,
static_content_store
=
contentstore
(),
static_content_store
=
contentstore
(),
target_location_namespace
=
location
,
target_location_namespace
=
location
,
draft_store
=
modulestore
()
draft_store
=
modulestore
()
)
)
# we can blow this away when we're done importing.
# we can blow this away when we're done importing.
...
...
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