mirror of
https://git.linux-kernel.at/oliver/ivatar.git
synced 2025-11-17 13:38:03 +00:00
Handle export upload errors gracefully. Fixes issue #53
This commit is contained in:
@@ -816,12 +816,16 @@ class UploadLibravatarExportView(SuccessMessageMixin, FormView):
|
||||
|
||||
def form_valid(self, form):
|
||||
data = self.request.FILES['export_file']
|
||||
try:
|
||||
items = libravatar_read_gzdata(data.read())
|
||||
# DEBUG print(items)
|
||||
return render(self.request, 'choose_libravatar_export.html', {
|
||||
'emails': items['emails'],
|
||||
'photos': items['photos'],
|
||||
})
|
||||
except Exception as e:
|
||||
messages.error(self.request, _('Unable to parse file: %s' % e))
|
||||
return HttpResponseRedirect(reverse_lazy('upload_export'))
|
||||
|
||||
|
||||
@method_decorator(login_required, name='dispatch')
|
||||
|
||||
Reference in New Issue
Block a user