From 1fa956926318b083d66d933c1b71e76f90a091e7 Mon Sep 17 00:00:00 2001 From: Jake Rosenberg Date: Mon, 11 Mar 2024 14:42:16 -0500 Subject: [PATCH] prevent 500 error on publications if datacite JSON can't be generated --- designsafe/apps/data/views/base.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/designsafe/apps/data/views/base.py b/designsafe/apps/data/views/base.py index 69c66e5cf9..e55406bfb0 100644 --- a/designsafe/apps/data/views/base.py +++ b/designsafe/apps/data/views/base.py @@ -236,7 +236,11 @@ def get_context_data(self, **kwargs): context['hybrid_simulations'] = getattr(pub, 'hybrid_simulations',[]) proj = ProjectsManager(service_account()).get_project_by_id(pub.projectId) - context['dc_json'] = json.dumps(proj.to_dataset_json()) + try: + context['dc_json'] = json.dumps(proj.to_dataset_json()) + except Exception: + # If we can't generate DataCite JSON, render the page without meta tags. + pass if self.request.user.is_authenticated: context['angular_init'] = json.dumps({