transform if to try/except in develop_steps

This commit is contained in:
Benjamin Bertrand 2016-02-09 10:14:54 +03:00
parent ba579c9ab3
commit 52ff23a749
1 changed files with 6 additions and 6 deletions

View File

@ -218,14 +218,14 @@ class Expression(Explicable):
def develop_steps(self, tokenList):
""" From a list of tokens, it develops steps of each tokens """
# TODO: Attention les étapes sont dans le mauvais sens |lun. avril 20 10:06:03 CEST 2015
tmp_steps = []
with Expression.tmp_render():
for t in tokenList:
if hasattr(t, "explain"):
for t in tokenList:
try:
with Expression.tmp_render():
tmp_steps.append([i for i in t.explain()])
else:
tmp_steps.append([t])
except AttributeError:
tmp_steps.append([t])
if max([len(i) for i in tmp_steps]) == 1:
# Cas où rien n'a dû être expliqué.
return []