From 45bd0462b0286c2b2cb88a1770b5daca049845a4 Mon Sep 17 00:00:00 2001 From: Robin Sonnabend <robin@fsmpi.rwth-aachen.de> Date: Mon, 14 May 2018 20:07:10 +0200 Subject: [PATCH] Improve error message if top.name is None /close #196 --- tasks.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tasks.py b/tasks.py index 6693d2b..a252926 100644 --- a/tasks.py +++ b/tasks.py @@ -496,13 +496,20 @@ def parse_protocol_async_inner(protocol): # TOPs old_tops = list(protocol.tops) - for top in old_tops: - protocol.tops.remove(top) + tops = [] for index, fork in enumerate( (child for child in tree.children if isinstance(child, Fork))): top = TOP( protocol_id=protocol.id, name=fork.name, number=index, planned=False) + if top.name is None: + return _make_error( + protocol, "Parsing", "TOP-Name fehlt", + "'{Name' sollte '{TOP Name' lauten.") + tops.append(top) + for top in old_tops: + protocol.tops.remove(top) + for top in tops: db.session.add(top) db.session.commit() -- GitLab