Export: Gracefully handle ExportEmptyError

This commit is contained in:
Raphael Michel
2023-10-23 16:57:08 +02:00
parent a0831890ad
commit 56acb0929a
3 changed files with 4 additions and 4 deletions

View File

@@ -63,7 +63,7 @@ class ExportEmptyError(ExportError):
pass
@app.task(base=ProfiledEventTask, throws=(ExportError,), bind=True)
@app.task(base=ProfiledEventTask, throws=(ExportError, ExportEmptyError), bind=True)
def export(self, event: Event, fileid: str, provider: str, form_data: Dict[str, Any]) -> None:
def set_progress(val):
if not self.request.called_directly:
@@ -94,7 +94,7 @@ def export(self, event: Event, fileid: str, provider: str, form_data: Dict[str,
return str(file.pk)
@app.task(base=ProfiledOrganizerUserTask, throws=(ExportError,), bind=True)
@app.task(base=ProfiledOrganizerUserTask, throws=(ExportError, ExportEmptyError), bind=True)
def multiexport(self, organizer: Organizer, user: User, device: int, token: int, fileid: str, provider: str,
form_data: Dict[str, Any], staff_session=False) -> None:
if device:

View File

@@ -2503,7 +2503,7 @@ class ExportMixin:
class ExportDoView(EventPermissionRequiredMixin, ExportMixin, AsyncAction, TemplateView):
permission = 'can_view_orders'
known_errortypes = ['ExportError']
known_errortypes = ['ExportError', 'ExportEmptyError']
task = export
template_name = 'pretixcontrol/orders/export_form.html'

View File

@@ -1726,7 +1726,7 @@ class ExportMixin:
class ExportDoView(OrganizerPermissionRequiredMixin, ExportMixin, AsyncAction, TemplateView):
known_errortypes = ['ExportError']
known_errortypes = ['ExportError', 'ExportEmptyError']
task = multiexport
template_name = 'pretixcontrol/organizers/export_form.html'