Fix re-exporting

rtd2
Eric Holscher 2010-08-15 01:48:28 -05:00
parent 4ab2ccb122
commit 109c7f4771
1 changed files with 5 additions and 1 deletions

View File

@ -230,6 +230,10 @@ def export(request, project_slug):
os.chdir(project.user_doc_path) os.chdir(project.user_doc_path)
dir_path = os.path.join(settings.MEDIA_ROOT, 'export', project.user.username) dir_path = os.path.join(settings.MEDIA_ROOT, 'export', project.user.username)
file_path = os.path.join(dir_path, '%s.zip' % project.slug) file_path = os.path.join(dir_path, '%s.zip' % project.slug)
os.makedirs(dir_path) try:
os.makedirs(dir_path)
except OSError:
#Directory already exists
pass
os.system('zip -r %s *' % file_path) os.system('zip -r %s *' % file_path)
return HttpResponseRedirect(os.path.join(settings.MEDIA_URL, 'export', project.user.username, '%s.zip' % project.slug)) return HttpResponseRedirect(os.path.join(settings.MEDIA_URL, 'export', project.user.username, '%s.zip' % project.slug))