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
619c144c
Commit
619c144c
authored
Feb 24, 2014
by
zubiar-arbi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Empty course temp folder after exporting course (export_handler)
STUD-1294
parent
663671ec
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
9 deletions
+5
-9
cms/djangoapps/contentstore/views/import_export.py
+5
-9
No files found.
cms/djangoapps/contentstore/views/import_export.py
View file @
619c144c
...
...
@@ -324,6 +324,9 @@ def export_handler(request, tag=None, package_id=None, branch=None, version_guid
try
:
export_to_xml
(
modulestore
(
'direct'
),
contentstore
(),
old_location
,
root_dir
,
name
,
modulestore
())
logging
.
debug
(
'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
,
e
:
logging
.
exception
(
'There was an error exporting course {0}. {1}'
.
format
(
course_module
.
location
,
unicode
(
e
)))
unit
=
None
...
...
@@ -352,7 +355,6 @@ def export_handler(request, tag=None, package_id=None, branch=None, version_guid
'edit_unit_url'
:
unit_locator
.
url_reverse
(
"unit"
)
if
parent
else
""
,
'course_home_url'
:
location
.
url_reverse
(
"course"
),
'export_url'
:
export_url
})
except
Exception
,
e
:
logging
.
exception
(
'There was an error exporting course {0}. {1}'
.
format
(
course_module
.
location
,
unicode
(
e
)))
...
...
@@ -364,14 +366,8 @@ def export_handler(request, tag=None, package_id=None, branch=None, version_guid
'course_home_url'
:
location
.
url_reverse
(
"course"
),
'export_url'
:
export_url
})
logging
.
debug
(
'tar file being generated at {0}'
.
format
(
export_file
.
name
))
tar_file
=
tarfile
.
open
(
name
=
export_file
.
name
,
mode
=
'w:gz'
)
tar_file
.
add
(
root_dir
/
name
,
arcname
=
name
)
tar_file
.
close
()
# remove temp dir
shutil
.
rmtree
(
root_dir
/
name
)
finally
:
shutil
.
rmtree
(
root_dir
/
name
)
wrapper
=
FileWrapper
(
export_file
)
response
=
HttpResponse
(
wrapper
,
content_type
=
'application/x-tgz'
)
...
...
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