Commits

angri committed 7b71192

MPClassManager.rebuild_subtree() removed

  • Participants
  • Parent commits e3e80c2

Comments (0)

Files changed (3)

 
 
 .. autoclass:: MPClassManager
-    :members: max_children, max_depth, query, rebuild_all_trees, rebuild_subtree
+    :members: max_children, max_depth, query, rebuild_all_trees
 
 .. autoclass:: MPInstanceManager
     :members: filter_descendants, query_descendants, filter_children, query_children, filter_ancestors, query_ancestors

sqlamp/__init__.py

           children and maximum nesting level (see :class:`MPManager` to learn
           more about limits fine-tuning) is done during session flush.
         * Rebuilding all trees (see :meth:`MPClassManager.rebuild_all_trees`)
-          and any subtree (:meth:`MPClassManager.rebuild_subtree`) on the
-          basis of Adjacency Relations.
+          on the basis of Adjacency Relations.
         * Collapsing flat tree returned from query to recursive structure (see
           :func:`tree_recursive_iterator`).
         * Node classes may use `polymorphic inheritance
                                  depth, tree_id, path, depth)
             prev_path = path
 
-    def rebuild_subtree(self, session, root_node_id, order_by=None):
-        """
-        Reset paths for all nodes in subtree defined by `root_node_id`
-        on the basis of adjacency relations.
-
-        :param session:
-            session object for DML queries.
-        :param root_node_id:
-            the value of subtree root's primary key.
-        :param order_by:
-            an "order by clause" for sorting children nodes
-            in each subtree.
-
-        .. versionchanged::
-            0.6
-            :meth:`rebuild_subtree` didn't receive ``session`` parameter
-            prior to 0.6.
-        """
-        opts = self._mp_opts
-        path, depth, tree_id = session.execute(sqlalchemy.select(
-            [opts.path_field, opts.depth_field, opts.tree_id_field],
-            opts.pk_field == root_node_id
-        )).fetchone()
-        if order_by is None:
-            order_by = opts.pk_field
-        self._do_rebuild_subtree(
-            session, root_node_id, path, depth, tree_id, order_by
-        )
-
     def _do_rebuild_subtree(self, session, root_node_id, root_path,
                             root_depth, tree_id, order_by):
         """

tests/functional-tests.py

         data_after = query.execute().fetchall()
         self.assertEqual(data_before, data_after)
 
-    def test_rebuild_subtree(self):
-        self._fill_tree()
-        query = sqlalchemy.select([tbl]).order_by(tbl.c.id)
-        data_before = query.execute().fetchall()
-        roots = self._corrupt_tree(including_roots=False)
-        # rebuilding each tree:
-        for root in roots:
-            Cls.mp.rebuild_subtree(self.sess, root.id, tbl.c.id)
-        # all trees should be in consistent state
-        # and be absolutely the same as before corruption.
-        data_after = query.execute().fetchall()
-        self.assertEqual(data_before, data_after)
-
 
 class QueriesTestCase(_BaseFunctionalTestCase):
     def test_descendants(self):