[ITree] more fixes, fix fixes
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 10 Jun 2010 16:57:02 +0200
changeset 5720 f0e521487903
parent 5719 8450389f2073
child 5722 61d6a4caa963
[ITree] more fixes, fix fixes
entities/adapters.py
web/views/treeview.py
--- a/entities/adapters.py	Thu Jun 10 16:57:00 2010 +0200
+++ b/entities/adapters.py	Thu Jun 10 16:57:02 2010 +0200
@@ -22,6 +22,7 @@
 __docformat__ = "restructuredtext en"
 
 from itertools import chain
+from warnings import warn
 
 from logilab.mtconverter import TransformError
 from logilab.common.decorators import cached
--- a/web/views/treeview.py	Thu Jun 10 16:57:00 2010 +0200
+++ b/web/views/treeview.py	Thu Jun 10 16:57:02 2010 +0200
@@ -184,7 +184,8 @@
 
     def cell_call(self, row, col):
         entity = self.cw_rset.get_entity(row, col)
-        if entity.cw_adapt_to('ITree') and not entity.is_leaf():
+        itree = entity.cw_adapt_to('ITree')
+        if itree and not itree.is_leaf():
             self.w(u'<div class="folder">%s</div>\n' % entity.view('oneline'))
         else:
             # XXX define specific CSS classes according to mime types
@@ -225,7 +226,7 @@
         itree = entity.cw_adapt_to('ITree')
         liclasses = []
         is_open = self.open_state(entity.eid, treeid)
-        is_leaf = not hasattr(entity, 'is_leaf') or itree.is_leaf()
+        is_leaf = itree is None or itree.is_leaf()
         if is_leaf:
             if is_last:
                 liclasses.append('last')