-
-
-class PackageView(UploadViewMixin, RedirectView):
- def dispatch(self, request, *args, **kwargs):
- self.object = self.get_object(request, *args, **kwargs)
- path = self.get_safe_path()
- with ZipFile(os.path.join(path, 'package.zip'), 'w') as zip_file:
- for f in os.listdir(path):
- if f == 'package.zip':
- continue
- zip_file.write(os.path.join(path, f), arcname = f)
- return super(PackageView, self).dispatch(request, *args, **kwargs)