# Path: cms/dateutil.py
# def utcnow(zero_seconds=False):
#     """ Returns a timezone aware version of utcnow.
#     If zero_seconds, the datetime will be rounded down to the minute.
#     """
#     now = datetime.datetime.now(pytz.utc)
#     if zero_seconds: return now.replace(second=0, microsecond=0)
#     return now
# 
# Path: cms/exceptions.py
# 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 folder import unindex_recursively
from collection import Collection
from interfaces import ITrash
from bson.objectid import ObjectId
from pyramid.security import authenticated_userid
from cms.dateutil import utcnow
from cms.exceptions import Veto
import zope.interface
import permissions
        self.dememento_child(child)
        orig_parent.move_child(child)

    def veto_restore_children(self, children):
        """ Return an error message is there is a problem with any of the proposed restores.
        Else return None.
        """
        children_by_parent_id = {}
        for child in children:
            err = self.veto_restore_child(child)
            if err: return "Can't restore child named \"%s\". (%s)" % (child._memento['orig_name'], err)
            parent_id = child._memento['orig_parent_id']
            if not children_by_parent_id.has_key(parent_id):
                children_by_parent_id[parent_id] = []
            children_by_parent_id[parent_id].append(child)
        # Check for items that would be restored to the same folder with the same name...
        for (parent_id, children) in children_by_parent_id.items():
            names = {}
            for child in children:
                child_name = child._memento['orig_name']
                if not names.has_key(child_name):
                    names[child_name] = 0
                names[child_name] += 1
            for (name, count) in names.items():
                if count > 1:
                    return "Can't restore all of the requested objects, since %s would have the non-unique name \"%s\"." % (count, name)
        return None

    def restore_children(self, children):
        error = self.veto_restore_children(children)

# Path: cms/dateutil.py
# def utcnow(zero_seconds=False):
#     """ Returns a timezone aware version of utcnow.
#     If zero_seconds, the datetime will be rounded down to the minute.
#     """
#     now = datetime.datetime.now(pytz.utc)
#     if zero_seconds: return now.replace(second=0, microsecond=0)
#     return now
# 
# Path: cms/exceptions.py
# 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/trash.py
from folder import unindex_recursively
from collection import Collection
from interfaces import ITrash
from bson.objectid import ObjectId
from pyramid.security import authenticated_userid
from cms.dateutil import utcnow
from cms.exceptions import Veto
import zope.interface
import permissions

        self.dememento_child(child)
        orig_parent.move_child(child)

    def veto_restore_children(self, children):
        """ Return an error message is there is a problem with any of the proposed restores.
        Else return None.
        """
        children_by_parent_id = {}
        for child in children:
            err = self.veto_restore_child(child)
            if err: return "Can't restore child named \"%s\". (%s)" % (child._memento['orig_name'], err)
            parent_id = child._memento['orig_parent_id']
            if not children_by_parent_id.has_key(parent_id):
                children_by_parent_id[parent_id] = []
            children_by_parent_id[parent_id].append(child)
        # Check for items that would be restored to the same folder with the same name...
        for (parent_id, children) in children_by_parent_id.items():
            names = {}
            for child in children:
                child_name = child._memento['orig_name']
                if not names.has_key(child_name):
                    names[child_name] = 0
                names[child_name] += 1
            for (name, count) in names.items():
                if count > 1:
                    return "Can't restore all of the requested objects, since %s would have the non-unique name \"%s\"." % (count, name)
        return None

    def restore_children(self, children):
        error = self.veto_restore_children(children)

        if error: raise Veto(error)