From c72c507cea7f924f31349b2f77b811ad35fff9db Mon Sep 17 00:00:00 2001 From: Daniele Andreotti Date: Wed, 27 Mar 2024 17:11:49 +0100 Subject: [PATCH] Improved check on token --- redturtle/bandi/indexer.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/redturtle/bandi/indexer.py b/redturtle/bandi/indexer.py index abc516e..65755a3 100644 --- a/redturtle/bandi/indexer.py +++ b/redturtle/bandi/indexer.py @@ -71,4 +71,8 @@ def tipologia_bando_label(object, **kw): if not object.tipologia_bando: return None vocab = TipologiaBandoVocabulary().__call__(object) + try: + vocab.getTermByToken(object.tipologia_bando) + except LookupError: + return None return vocab.getTermByToken(object.tipologia_bando).title