# Path: cms/orderutil.py
# def reorder_ids_by_delta(all_ids, ids_to_reorder, delta):
# def reorder_ids_up(all_ids, ids_to_reorder, delta=1):
# def reorder_ids_down(all_ids, ids_to_reorder, delta=1):
# def reorder_ids_to_top(all_ids, ids_to_reorder):
# def reorder_ids_to_bottom(all_ids, ids_to_reorder):
# 
# Path: cms/exceptions.py
# class NonOrderedFolderException(Exception):
#     """ Raised by some Folder methods when an attempt is made to call some method that depends
#     on ordering, but the given folder is unordered.
#     """
#     def __init__(self):
#         Exception.__init__(self, "This folder doesn't support ordering.")
# 
# class Veto(Exception):
#     """ May be raised when an attempt is made to do something that the CMS doesn't allow,
#     such as adding an object to a folder with a name that's already in use.
#     Higher level code (such as views) may want to catch these Veto exceptions
#     and present them to end users in a friendly manner.
#     """
#     def __init__(self, msg):
#         Exception.__init__(self, msg)


from content import Content
from collection import Collection
from pyramid import security
from cms import orderutil
from cms.exceptions import NonOrderedFolderException, Veto
import colander, deform
import widgets
        newchild._id = None
        newchild._created = None
        # Clear _pub_state, if any.
        if hasattr(newchild, '_pub_state'):
            del newchild._pub_state
        newname = obj.__name__
        if self.has_child(newname): newname = self.get_unique_name(newname)
        self.add_child(newname, newchild)
        # Recursively copy children...
        if isinstance(obj, Folder):
            for child in obj.get_children_lazily():
                newchild.copy_child(child)
        return newchild
    

    def veto_copy_children(self, objects):
        """ This method will return an error string if there is a problem with any of the proposed copies.
        Else returns None.
        """
        for obj in objects:
            error = self.veto_add_child(obj.__name__, obj, unique=False)
            if error: return "Cannot move \"%s\". %s" % (obj.__name__, error)
        return None

    def copy_children(self, objects):
        """ Copy several objects into this folder.
        This method will return a list of 2-tuples, where each is a pair of (original_object, copy_object).
        This method will validate the proposed copies first and raise an exception if there is any problem.
        """
        error = self.veto_copy_children(objects)

# Path: cms/orderutil.py
# def reorder_ids_by_delta(all_ids, ids_to_reorder, delta):
# def reorder_ids_up(all_ids, ids_to_reorder, delta=1):
# def reorder_ids_down(all_ids, ids_to_reorder, delta=1):
# def reorder_ids_to_top(all_ids, ids_to_reorder):
# def reorder_ids_to_bottom(all_ids, ids_to_reorder):
# 
# Path: cms/exceptions.py
# class NonOrderedFolderException(Exception):
#     """ Raised by some Folder methods when an attempt is made to call some method that depends
#     on ordering, but the given folder is unordered.
#     """
#     def __init__(self):
#         Exception.__init__(self, "This folder doesn't support ordering.")
# 
# class Veto(Exception):
#     """ May be raised when an attempt is made to do something that the CMS doesn't allow,
#     such as adding an object to a folder with a name that's already in use.
#     Higher level code (such as views) may want to catch these Veto exceptions
#     and present them to end users in a friendly manner.
#     """
#     def __init__(self, msg):
#         Exception.__init__(self, msg)


# Path: cms/resources/folder.py
from content import Content
from collection import Collection
from pyramid import security
from cms import orderutil
from cms.exceptions import NonOrderedFolderException, Veto
import colander, deform
import widgets

        newchild._id = None
        newchild._created = None
        # Clear _pub_state, if any.
        if hasattr(newchild, '_pub_state'):
            del newchild._pub_state
        newname = obj.__name__
        if self.has_child(newname): newname = self.get_unique_name(newname)
        self.add_child(newname, newchild)
        # Recursively copy children...
        if isinstance(obj, Folder):
            for child in obj.get_children_lazily():
                newchild.copy_child(child)
        return newchild
    

    def veto_copy_children(self, objects):
        """ This method will return an error string if there is a problem with any of the proposed copies.
        Else returns None.
        """
        for obj in objects:
            error = self.veto_add_child(obj.__name__, obj, unique=False)
            if error: return "Cannot move \"%s\". %s" % (obj.__name__, error)
        return None

    def copy_children(self, objects):
        """ Copy several objects into this folder.
        This method will return a list of 2-tuples, where each is a pair of (original_object, copy_object).
        This method will validate the proposed copies first and raise an exception if there is any problem.
        """
        error = self.veto_copy_children(objects)

        if error: raise Veto(error)