# 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
    def reorder_names_up(self, names_to_reorder, delta=1):
        names = self.get_ordered_names()
        if names is None: raise NonOrderedFolderException()
        reordered_names = orderutil.reorder_ids_up(names, names_to_reorder, delta)
        if reordered_names:
            self._ordered_names = names
            self.save()
        return reordered_names

    def reorder_names_down(self, names_to_reorder, delta=1):
        names = self.get_ordered_names()
        if names is None: raise NonOrderedFolderException()
        reordered_names = orderutil.reorder_ids_down(names, names_to_reorder, delta)
        if reordered_names:
            self._ordered_names = names
            self.save()
        return reordered_names

    def reorder_names_to_top(self, names_to_reorder):
        names = self.get_ordered_names()
        if names is None: raise NonOrderedFolderException()
        reordered_names = orderutil.reorder_ids_to_top(names, names_to_reorder)
        if reordered_names:
            self._ordered_names = names
            self.save()
        return reordered_names

    def reorder_names_to_bottom(self, names_to_reorder):
        names = self.get_ordered_names()
        if names is None: raise NonOrderedFolderException()

# 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

    def reorder_names_up(self, names_to_reorder, delta=1):
        names = self.get_ordered_names()
        if names is None: raise NonOrderedFolderException()
        reordered_names = orderutil.reorder_ids_up(names, names_to_reorder, delta)
        if reordered_names:
            self._ordered_names = names
            self.save()
        return reordered_names

    def reorder_names_down(self, names_to_reorder, delta=1):
        names = self.get_ordered_names()
        if names is None: raise NonOrderedFolderException()
        reordered_names = orderutil.reorder_ids_down(names, names_to_reorder, delta)
        if reordered_names:
            self._ordered_names = names
            self.save()
        return reordered_names

    def reorder_names_to_top(self, names_to_reorder):
        names = self.get_ordered_names()
        if names is None: raise NonOrderedFolderException()
        reordered_names = orderutil.reorder_ids_to_top(names, names_to_reorder)
        if reordered_names:
            self._ordered_names = names
            self.save()
        return reordered_names

    def reorder_names_to_bottom(self, names_to_reorder):
        names = self.get_ordered_names()
        if names is None: raise NonOrderedFolderException()

        reordered_names = orderutil.reorder_ids_to_bottom(names, names_to_reorder)