def download_debug(request): """ Create zipfile and send it back to client """ # XXX when we implement RBAC this method needs to be ADMIN-level only zipfile = create_debug_zipfile() wrapper = FileWrapper(file(zipfile)) response = HttpResponse(wrapper, content_type='application/zip') zipname = os.path.basename(zipfile) response['Content-Disposition'] = 'attachment; filename=%s' % zipname response['Content-Length'] = os.stat(zipfile).st_size return response
def handle(self, *args, **options): fname = create_debug_zipfile(options['no_summary']) print 'Zipfile created: %s' % fname