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
17 f = open(os.path.join(extract_to, m), 'w')
\r
18 f.write(dump.read(m))
\r
21 #dump.extractall(extract_to, members)
\r
23 importer.sximport(extract_to, request.POST)
\r
25 return render_to_response('modules/sximporter/page.html', {
\r
27 }, context_instance=RequestContext(request))