From e4084cdc8fc6b88562733eb66cbe7718e24cc9a2 Mon Sep 17 00:00:00 2001
From: "J.-S. Caux" <J.S.Caux@uva.nl>
Date: Mon, 22 Jan 2018 13:15:42 +0100
Subject: [PATCH] Fix unbound error

---
 journals/views.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/journals/views.py b/journals/views.py
index d110e2b10..bd3272c97 100644
--- a/journals/views.py
+++ b/journals/views.py
@@ -1084,13 +1084,14 @@ def generic_metadata_xml_deposit(request, **kwargs):
     """
     type_of_object = kwargs['type_of_object']
     object_id = int(kwargs['object_id'])
-    relation_to_published = _object.relation_to_published()
 
     if type_of_object == 'report':
         _object = get_object_or_404(Report, id=object_id)
     elif type_of_object == 'comment':
         _object = get_object_or_404(Comment, id=object_id)
 
+    relation_to_published = _object.relation_to_published()
+
     if not _object.doi_label:
         _object.create_doi_label()
 
-- 
GitLab