From 119b85568f0cc0454af59180a3b8046c73d4ca7b Mon Sep 17 00:00:00 2001 From: Ozbolt Menegatti Date: Sat, 1 Jun 2019 10:35:23 +0200 Subject: [PATCH] actually not showing components without representation --- wani.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/wani.py b/wani.py index 3fc185d..9a40078 100644 --- a/wani.py +++ b/wani.py @@ -177,9 +177,6 @@ class ComponentRepresentation: def render(self): if self.rendition_text is None: self.rendition_text = self._render() - - def rendition(self): - return "" if self.rendition_text is None else self.rendition_text def _render(self): raise NotImplementedError("Not implemented for class: {}".format(type(self))) @@ -502,8 +499,13 @@ class ComponentRendition: rep.render() for cid, reps in representations.items(): - rep = " ".join(rep.rendition() for rep in reps) - matches.representations[cid] = rep + reps = [rep.rendition_text for rep in reps] + if len(reps) == 0: + pass + elif all(r is None for r in reps): + matches.representations[cid] = None + else: + matches.representations[cid] = " ".join(("" if r is None else r) for r in reps) # # just need to set representation to first group, # # but in correct order, agreements last!