# 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
        attempt = 0
        while 1:
            if attempt:
                candidate = "%s%s%s%s" % (name, sep, attempt, suffix)
            else:
                candidate = name+suffix
            if not self.has_child(candidate):
                return candidate
            attempt += 1

    def veto_add_child(self, name, child, unique=True):
        # Return an error message (string) if there's any reason why the specified child can't be added with the specified name.
        # Otherwise return None
        if child._object_type not in self._allowed_child_types:
            return "This %s does not allow child objects of type %s." % (self._object_type, child._object_type)
        error = Collection.veto_add_child(self, name, child, unique=unique)
        if error: return error
        return None

    def veto_move_child(self, obj):
        if obj._id == self._id:
            return "Can't move an object into itself."
        if obj._id in self.get_id_path():
            return "Can't move an object into a child of itself."
        return self.veto_add_child(obj.__name__, obj)

    def move_child(self, obj):
        """ Move an object into this folder. """
        if obj.__parent__._id == self._id: return 0
        error = self.veto_move_child(obj)

# 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

        attempt = 0
        while 1:
            if attempt:
                candidate = "%s%s%s%s" % (name, sep, attempt, suffix)
            else:
                candidate = name+suffix
            if not self.has_child(candidate):
                return candidate
            attempt += 1

    def veto_add_child(self, name, child, unique=True):
        # Return an error message (string) if there's any reason why the specified child can't be added with the specified name.
        # Otherwise return None
        if child._object_type not in self._allowed_child_types:
            return "This %s does not allow child objects of type %s." % (self._object_type, child._object_type)
        error = Collection.veto_add_child(self, name, child, unique=unique)
        if error: return error
        return None

    def veto_move_child(self, obj):
        if obj._id == self._id:
            return "Can't move an object into itself."
        if obj._id in self.get_id_path():
            return "Can't move an object into a child of itself."
        return self.veto_add_child(obj.__name__, obj)

    def move_child(self, obj):
        """ Move an object into this folder. """
        if obj.__parent__._id == self._id: return 0
        error = self.veto_move_child(obj)

        if error: raise Veto(error)