1 from django.shortcuts import render_to_response
\r
2 from django.template import RequestContext
\r
3 from forum.views.admin import super_user_required
\r
5 from zipfile import ZipFile
\r
9 def sximporter(request):
\r
11 if request.method == "POST" and "dump" in request.FILES:
\r
12 dump = ZipFile(request.FILES['dump'])
\r
13 members = [f for f in dump.namelist() if f.endswith('.xml')]
\r
14 extract_to = os.path.join(os.path.dirname(__file__), 'tmp')
\r
15 dump.extractall(extract_to, members)
\r
16 importer.sximport(extract_to, request.POST)
\r
19 return render_to_response('modules/sximporter/page.html', {
\r
21 }, context_instance=RequestContext(request))