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
7ee08eae
Commit
7ee08eae
authored
11 years ago
by
zubair-arbi
Browse files
Options
Downloads
Plain Diff
Merge pull request #2688 from edx/zub/bugfix/std1294-importexportcruft
Empty course temp folder after exporting course (export_handler)
parents
458943c8
619c144c
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cms/djangoapps/contentstore/views/import_export.py
+5
-9
5 additions, 9 deletions
cms/djangoapps/contentstore/views/import_export.py
with
5 additions
and
9 deletions
cms/djangoapps/contentstore/views/import_export.py
+
5
−
9
View file @
7ee08eae
...
...
@@ -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
'
)
...
...
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