Back to index

plone3  3.1.7
BaseContent.py
Go to the documentation of this file.
00001 from Products.Archetypes import WebDAVSupport
00002 from Products.Archetypes.BaseObject import BaseObject
00003 from Products.Archetypes.ExtensibleMetadata import ExtensibleMetadata
00004 from Products.Archetypes.interfaces import IBaseContent
00005 from Products.Archetypes.interfaces import IReferenceable
00006 from Products.Archetypes.interfaces.base import IBaseContent as z2IBaseContent
00007 from Products.Archetypes.interfaces.referenceable import IReferenceable as z2IReferenceable
00008 from Products.Archetypes.interfaces.metadata import IExtensibleMetadata
00009 from Products.Archetypes.CatalogMultiplex import CatalogMultiplex
00010 
00011 from AccessControl import ClassSecurityInfo
00012 from Globals import InitializeClass
00013 from OFS.History import Historical
00014 from Products.CMFCore import permissions
00015 from Products.CMFCore.PortalContent import PortalContent
00016 from OFS.PropertyManager import PropertyManager
00017 
00018 from zope.interface import implements
00019 
00020 class BaseContentMixin(CatalogMultiplex,
00021                        BaseObject,
00022                        PortalContent,
00023                        Historical):
00024     """A not-so-basic CMF Content implementation that doesn't
00025     include Dublin Core Metadata"""
00026 
00027     __implements__ = z2IBaseContent, z2IReferenceable, PortalContent.__implements__
00028     implements(IBaseContent, IReferenceable)
00029 
00030     security = ClassSecurityInfo()
00031     manage_options = PortalContent.manage_options + Historical.manage_options
00032 
00033     isPrincipiaFolderish = 0
00034     isAnObjectManager = 0
00035     __dav_marshall__ = True
00036 
00037     security.declarePrivate('manage_afterAdd')
00038     def manage_afterAdd(self, item, container):
00039         BaseObject.manage_afterAdd(self, item, container)
00040 
00041     security.declarePrivate('manage_afterClone')
00042     def manage_afterClone(self, item):
00043         BaseObject.manage_afterClone(self, item)
00044 
00045     security.declarePrivate('manage_beforeDelete')
00046     def manage_beforeDelete(self, item, container):
00047         BaseObject.manage_beforeDelete(self, item, container)
00048         #and reset the rename flag (set in Referenceable._notifyCopyOfCopyTo)
00049         self._v_cp_refs = None
00050 
00051     def _notifyOfCopyTo(self, container, op=0):
00052         """OFS.CopySupport notify
00053         """
00054         BaseObject._notifyOfCopyTo(self, container, op=op)
00055         # keep reference info internally when op == 1 (move)
00056         # because in those cases we need to keep refs
00057         if op==1:
00058             self._v_cp_refs = 1
00059 
00060     security.declareProtected(permissions.ModifyPortalContent, 'PUT')
00061     PUT = WebDAVSupport.PUT
00062 
00063     security.declareProtected(permissions.View, 'manage_FTPget')
00064     manage_FTPget = WebDAVSupport.manage_FTPget
00065 
00066     security.declarePrivate('manage_afterPUT')
00067     manage_afterPUT = WebDAVSupport.manage_afterPUT
00068 
00069 InitializeClass(BaseContentMixin)
00070 
00071 class BaseContent(BaseContentMixin,
00072                   ExtensibleMetadata,
00073                   PropertyManager):
00074     """A not-so-basic CMF Content implementation with Dublin Core
00075     Metadata included"""
00076 
00077     __implements__ = BaseContentMixin.__implements__, IExtensibleMetadata
00078     implements(IBaseContent, IReferenceable)
00079 
00080     schema = BaseContentMixin.schema + ExtensibleMetadata.schema
00081 
00082     manage_options = BaseContentMixin.manage_options + \
00083         PropertyManager.manage_options
00084 
00085     def __init__(self, oid, **kwargs):
00086         BaseContentMixin.__init__(self, oid, **kwargs)
00087         ExtensibleMetadata.__init__(self)
00088 
00089 InitializeClass(BaseContent)
00090 
00091 
00092 BaseSchema = BaseContent.schema
00093 
00094 __all__ = ('BaseContent', 'BaseContentMixin', 'BaseSchema', )