X-Git-Url: https://git.openstreetmap.org./osqa.git/blobdiff_plain/cae5bfd94d187b8258411467ad6231f24b84e4f0..e866fb958cebc4321b42b7a318c6a156cf4b4b1a:/forum_modules/sximporter/views.py diff --git a/forum_modules/sximporter/views.py b/forum_modules/sximporter/views.py index 76bc8e4..dcca241 100644 --- a/forum_modules/sximporter/views.py +++ b/forum_modules/sximporter/views.py @@ -12,10 +12,19 @@ def sximporter(request): dump = ZipFile(request.FILES['dump']) members = [f for f in dump.namelist() if f.endswith('.xml')] extract_to = os.path.join(os.path.dirname(__file__), 'tmp') - dump.extractall(extract_to, members) - importer.sximport(extract_to, request.POST) + + if not os.path.exists(extract_to): + os.makedirs(extract_to) + + for m in members: + f = open(os.path.join(extract_to, m), 'w') + f.write(dump.read(m)) + f.close() + + #dump.extractall(extract_to, members) dump.close() + importer.sximport(extract_to, request.POST) return render_to_response('modules/sximporter/page.html', { 'names': list - }, context_instance=RequestContext(request)) \ No newline at end of file + }, context_instance=RequestContext(request))