# 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
    """
    zope.interface.implements(ITrash)

    _object_type = "trash"

    def __init__(self, request):
        self.request = request
        self._collection_name = "content"
        self.title = "Trash"
        self.description = "Content can be moved here as an alternative to deleting it forever."
        self.__acl__ = permissions.trash_acl
        self._id = 'trash'
    
    def _morph_spec(self, spec):
        if spec is None: spec = {}
        # Make sure parent is in the spec.
        spec['__parent__'] = self._id
        return spec

    def _get_child_class(self, doc):
        return self.__parent__.get_content_factory(doc['_object_type'])

    def move_child(self, obj):
        if obj.__parent__._id == self._id: return
        orig_parent = obj.__parent__
        orig_name = obj.__name__
        obj._memento = dict(
            orig_name = orig_name,
            orig_parent_id = orig_parent._id,
            orig_parent_path = orig_parent.resource_path(),

# 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

    """
    zope.interface.implements(ITrash)

    _object_type = "trash"

    def __init__(self, request):
        self.request = request
        self._collection_name = "content"
        self.title = "Trash"
        self.description = "Content can be moved here as an alternative to deleting it forever."
        self.__acl__ = permissions.trash_acl
        self._id = 'trash'
    
    def _morph_spec(self, spec):
        if spec is None: spec = {}
        # Make sure parent is in the spec.
        spec['__parent__'] = self._id
        return spec

    def _get_child_class(self, doc):
        return self.__parent__.get_content_factory(doc['_object_type'])

    def move_child(self, obj):
        if obj.__parent__._id == self._id: return
        orig_parent = obj.__parent__
        orig_name = obj.__name__
        obj._memento = dict(
            orig_name = orig_name,
            orig_parent_id = orig_parent._id,
            orig_parent_path = orig_parent.resource_path(),

            trashed_at = utcnow(),