From b87371d8a48928153ac14f77757c77af836d1dbe Mon Sep 17 00:00:00 2001 From: patrick Date: Fri, 7 May 2021 11:15:06 +0000 Subject: [PATCH] fix if there is no etherpad, no pdf file should be generated. --- fet2020/posts/views.py | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/fet2020/posts/views.py b/fet2020/posts/views.py index 79f4d362..0c46473e 100644 --- a/fet2020/posts/views.py +++ b/fet2020/posts/views.py @@ -142,25 +142,17 @@ def show(request, id=None): filename_agenda = None filename_protocol = None - if p.has_agenda: # and p.agenda_key: - try: - ep_agenda_link = get_pad_link(p.agenda_key) - filename_agenda = p.slug + "-agenda.pdf" - except Exception as e: - logger.error( - "Can't get the agenda link from '%s'. Error: %s", p.agenda_key, e - ) - ep_agenda_link = "#" + if p.has_agenda: + ep_agenda_link = get_pad_link(p.agenda_key) - if p.has_protocol: # and p.protocol_key: - try: - ep_protocol_link = get_pad_link(p.protocol_key) + if ep_agenda_link != "#": + filename_agenda = p.slug + "-agenda.pdf" + + if p.has_protocol: + ep_protocol_link = get_pad_link(p.protocol_key) + + if ep_protocol_link != "#": filename_protocol = p.slug + "-protokoll.pdf" - except Exception as e: - logger.error( - "Can't get the protocol link from '%s. Error: %s", p.protocol_key, e - ) - ep_protocol_link = "#" related_posts = p.tags.similar_objects()