#NEWLINE# def _make_child_root_node( self , node , new_tree_id = None ) : #NEWLINE# #INDENT# '\n        Removes ``node`` from its tree, making it the root node of a new\n        tree.\n\n        If ``new_tree_id`` is not specified a new tree id will be\n        generated.\n\n        ``node`` will be modified to reflect its new tree state in the\n        database.\n        ' #NEWLINE# left = getattr ( node , self . left_attr ) #NEWLINE# right = getattr ( node , self . right_attr ) #NEWLINE# level = getattr ( node , self . level_attr ) #NEWLINE# if ( not new_tree_id ) : #NEWLINE# #INDENT# new_tree_id = self . _get_next_tree_id ( ) #NEWLINE# #UNINDENT# left_right_change = ( left - 1 ) #NEWLINE# self . _inter_tree_move_and_close_gap ( node , level , left_right_change , new_tree_id ) #NEWLINE# setattr ( node , self . left_attr , ( left - left_right_change ) ) #NEWLINE# setattr ( node , self . right_attr , ( right - left_right_change ) ) #NEWLINE# setattr ( node , self . level_attr , 0 ) #NEWLINE# setattr ( node , self . tree_id_attr , new_tree_id ) #NEWLINE# setattr ( node , self . parent_attr , None ) #NEWLINE# node . _mptt_cached_fields [ self . parent_attr ] = None