Skip to content
Snippets Groups Projects
Commit fd43dbed8a1d authored by Sylvain Thénault's avatar Sylvain Thénault
Browse files

catch TypeResolverError in case a parent entity also implements ITree but is...

catch TypeResolverError in case a parent entity also implements ITree but is not the root entity (closes #1956066)
parent 1661f7a5601f
No related branches found
No related tags found
No related merge requests found
......@@ -7,6 +7,7 @@
__docformat__ = "restructuredtext en"
from logilab.common.textutils import normalize_text
from rql import TypeResolverException
from cubicweb.view import EntityView
from cubicweb.selectors import is_instance
......@@ -78,8 +79,12 @@
cpath = itree.path()[1:]
indentlevel = len(cpath) - 1
for i, ceid in enumerate(cpath):
comment = self._cw.execute('Any C,T,D WHERE C creation_date D, C content T, C eid %(x)s',
{'x': ceid}, build_descr=True).get_entity(0, 0)
try:
comment = self._cw.execute('Any C,T,D WHERE C creation_date D, C content T, C eid %(x)s',
{'x': ceid}, build_descr=True).get_entity(0, 0)
except TypeResolverException:
# not a comment
break
strings.append(comment.view('fulltext', indentlevel=indentlevel-i,
withauthor=i!=indentlevel).strip() + '\n')
strings.append(u'\n%s: %s' % (self._cw._('i18n_by_author_field'),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment