[CMF-checkins] CVS: Products/CMFCore - PortalFolder.py:1.71.2.3
Yvo Schubbe
y.2004_ at wcm-solutions.de
Sun Sep 19 09:15:02 EDT 2004
Update of /cvs-repository/Products/CMFCore
In directory cvs.zope.org:/tmp/cvs-serv4605/CMFCore
Modified Files:
Tag: CMF-1_5-branch
PortalFolder.py
Log Message:
- removed docstrings from 'content*' methods
- added Folderish Interface
=== Products/CMFCore/PortalFolder.py 1.71.2.2 => 1.71.2.3 ===
--- Products/CMFCore/PortalFolder.py:1.71.2.2 Tue Sep 7 04:47:53 2004
+++ Products/CMFCore/PortalFolder.py Sun Sep 19 09:14:32 2004
@@ -32,6 +32,7 @@
from exceptions import AccessControl_Unauthorized
from exceptions import BadRequest
from exceptions import zExceptions_Unauthorized
+from interfaces.Folderish import Folderish as IFolderish
from permissions import AddPortalContent
from permissions import AddPortalFolders
from permissions import ChangeLocalRoles
@@ -102,7 +103,8 @@
meta_type = 'Portal Folder'
portal_type = 'Folder'
- __implements__ = (DynamicType.__implements__, OrderedFolder.__implements__)
+ __implements__ = (IFolderish, DynamicType.__implements__,
+ OrderedFolder.__implements__)
security = ClassSecurityInfo()
@@ -115,20 +117,24 @@
self.id = id
self.title = title
+ #
+ # 'MutableDublinCore' interface methods
+ #
security.declareProtected(ManageProperties, 'setTitle')
def setTitle( self, title ):
- """
- Edit the folder title.
+ """ Set Dublin Core Title element - resource name.
"""
self.title = title
security.declareProtected(ManageProperties, 'setDescription')
def setDescription( self, description ):
- """
- Edit the folder description.
+ """ Set Dublin Core Description element - resource summary.
"""
self.description = description
+ #
+ # other methods
+ #
security.declareProtected(ManageProperties, 'edit')
def edit(self, title='', description=''):
"""
@@ -229,12 +235,27 @@
append( (id, obj) )
return result
+ #
+ # 'Folderish' interface methods
+ #
+ security.declarePublic('contentItems')
+ def contentItems( self, spec=None, filter=None ):
+ # List contentish and folderish sub-objects and their IDs.
+ # (method is without docstring to disable publishing)
+ #
+ if spec is None:
+ ids = self.objectIds()
+ else:
+ # spec is deprecated, use filter instead!
+ spec = self._morphSpec(spec)
+ ids = self.objectIds(spec)
+ return self._filteredItems( ids, filter )
+
security.declarePublic('contentIds')
def contentIds( self, spec=None, filter=None):
- """
- Provide a filtered view onto 'objectIds', allowing only
- PortalFolders and PortalContent-derivatives to show through.
- """
+ # List IDs of contentish and folderish sub-objects.
+ # (method is without docstring to disable publishing)
+ #
if spec is None:
ids = self.objectIds()
else:
@@ -246,10 +267,9 @@
security.declarePublic('contentValues')
def contentValues( self, spec=None, filter=None ):
- """
- Provide a filtered view onto 'objectValues', allowing only
- PortalFolders and PortalContent-derivatives to show through.
- """
+ # List contentish and folderish sub-objects.
+ # (method is without docstring to disable publishing)
+ #
if spec is None:
ids = self.objectIds()
else:
@@ -261,9 +281,7 @@
security.declareProtected(ListFolderContents, 'listFolderContents')
def listFolderContents( self, spec=None, contentFilter=None ):
- """
- Hook around 'contentValues' to let 'folder_contents'
- be protected. Duplicating skip_unauthorized behavior of dtml-in.
+ """ List viewable contentish and folderish sub-objects.
"""
items = self.contentItems(spec=spec, filter=contentFilter)
l = []
@@ -277,45 +295,38 @@
pass
return l
- security.declarePublic('contentItems')
- def contentItems( self, spec=None, filter=None ):
- """
- Provide a filtered view onto 'objectItems', allowing only
- PortalFolders and PortalContent-derivatives to show through.
- """
- if spec is None:
- ids = self.objectIds()
- else:
- # spec is deprecated, use filter instead!
- spec = self._morphSpec(spec)
- ids = self.objectIds(spec)
- return self._filteredItems( ids, filter )
+ #
+ # webdav Resource method
+ #
# protected by 'WebDAV access'
def listDAVObjects(self):
+ # List sub-objects for PROPFIND requests.
+ # (method is without docstring to disable publishing)
+ #
if _checkPermission(ManagePortal, self):
return self.objectValues()
else:
return self.listFolderContents()
+ #
+ # 'DublinCore' interface methods
+ #
security.declareProtected(View, 'Title')
def Title( self ):
- """
- Implement dublin core Title
+ """ Dublin Core Title element - resource name.
"""
return self.title
security.declareProtected(View, 'Description')
def Description( self ):
- """
- Implement dublin core Description
+ """ Dublin Core Description element - resource summary.
"""
return self.description
security.declareProtected(View, 'Type')
def Type( self ):
- """
- Implement dublin core type
+ """ Dublin Core Type element - resource type.
"""
if hasattr(aq_base(self), 'getTypeInfo'):
ti = self.getTypeInfo()
@@ -323,6 +334,9 @@
return ti.Title()
return self.meta_type
+ #
+ # other methods
+ #
security.declarePublic('encodeFolderFilter')
def encodeFolderFilter(self, REQUEST):
"""
@@ -563,7 +577,6 @@
Represent a predicate against a content object's metadata.
"""
MARKER = []
- filterCreator = []
filterSubject = []
def __init__( self
, Title=MARKER
@@ -588,8 +601,7 @@
self.description.append( 'Title: %s' % Title )
if Creator and Creator is not self.MARKER:
- self.filterCreator = Creator
- self.predicates.append( lambda x, creator=self.filterCreator:
+ self.predicates.append( lambda x, creator=Creator:
creator in x.listCreators() )
self.description.append( 'Creator: %s' % Creator )
More information about the CMF-checkins
mailing list