Commit df37a4d1 authored by Nicola Spanti's avatar Nicola Spanti
Browse files

[py] Manage case `` is an exception

In a client project, we add the case of `` being
`UException` (from `cubicweb_nemo.utils`). It resulted in a
problem, because `` is `True` as boolean, but it has
no key, so it crashed. This patch does not resolve the real
problem of having a clean `info` member or knowing why it could
normally have a different type, but at least it eliminates a
problem for the final users.
parent 256d437ec4d9
......@@ -13,7 +13,7 @@
# details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <>.
# along with this program. If not, see <>.
"""cubicweb-celerytask entity's classes"""
import six
......@@ -204,16 +204,18 @@ class ICeleryTask(EntityAdapter):
if celery.current_app.conf.task_always_eager:
return 1.
result = self.result
if and 'progress' in
elif self.entity.reverse_parent_task:
if and 'progress' in
except TypeError:
if self.entity.reverse_parent_task:
children = self.entity.reverse_parent_task
return sum(child.cw_adapt_to('ICeleryTask').progress
for child in children) / len(children)
elif result.state == STATES.SUCCESS:
if result.state == STATES.SUCCESS:
return 1.
return 0.
return 0.
def state(self):
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment