Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CONCD-712 I'm just going to catch all, here #2303

Merged
merged 1 commit into from
Mar 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions exporter/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

import bagit
import boto3
from asgiref.sync import sync_to_async
from django.conf import settings
from django.contrib.admin.views.decorators import staff_member_required
from django.contrib.postgres.aggregates.general import StringAgg
from django.core.exceptions import SynchronousOnlyOperation
from django.db.models import OuterRef, Subquery
from django.http import HttpResponse, HttpResponseRedirect
from django.utils.decorators import method_decorator
Expand Down Expand Up @@ -234,8 +234,12 @@ def get(self, request, *args, **kwargs):
return export_to_csv_response(
"%s.csv" % self.kwargs["campaign_slug"], headers, data
)
except SynchronousOnlyOperation as e:
logger.info("Failed to export csv, error was: %s", e)
except Exception:
logger.info("Attemping to convert function to async")
export_csv_async = sync_to_async(export_to_csv_response)
return export_csv_async(
"%s.csv" % self.kwargs["campaign_slug"], headers, data
)


class ExportItemToBagIt(TemplateView):
Expand Down