web/views/treeview.py
changeset 5569 cb14af012a96
parent 5557 1a534c596bff
child 5597 180229f07c12
--- a/web/views/treeview.py	Fri May 21 15:02:56 2010 +0200
+++ b/web/views/treeview.py	Fri May 21 15:04:29 2010 +0200
@@ -28,6 +28,7 @@
 from cubicweb.utils import make_uid
 from cubicweb.selectors import implements, adaptable
 from cubicweb.view import EntityView, EntityAdapter, implements_adapter_compat
+from cubicweb.mixins import _done_init
 from cubicweb.web import json
 from cubicweb.interfaces import ITree
 from cubicweb.web.views import baseviews
@@ -186,21 +187,6 @@
         return path
 
 
-def _done_init(done, view, row, col):
-    """handle an infinite recursion safety belt"""
-    if done is None:
-        done = set()
-    entity = view.cw_rset.get_entity(row, col)
-    if entity.eid in done:
-        msg = entity._cw._('loop in %(rel)s relation (%(eid)s)') % {
-            'rel': entity.tree_attribute,
-            'eid': entity.eid
-            }
-        return None, msg
-    done.add(entity.eid)
-    return done, entity
-
-
 class BaseTreeView(baseviews.ListView):
     """base tree view"""
     __regid__ = 'tree'