[CMF-checkins] CVS: CMF/CMFCore/interfaces - Discussions.py:1.2.50.1 DublinCore.py:1.3.50.1 Syndicatable.py:1.2.50.1 portal_catalog.py:1.6.12.2
Yvo Schubbe
schubbe@web.de
Fri, 20 Dec 2002 11:39:21 -0500
Update of /cvs-repository/CMF/CMFCore/interfaces
In directory cvs.zope.org:/tmp/cvs-serv21281/CMFCore/interfaces
Modified Files:
Tag: yuppie-collector096-branch
Discussions.py DublinCore.py Syndicatable.py portal_catalog.py
Log Message:
more interface cleanups:
- added interface tests and made them pass
=== CMF/CMFCore/interfaces/Discussions.py 1.2 => 1.2.50.1 ===
--- CMF/CMFCore/interfaces/Discussions.py:1.2 Wed Nov 28 14:06:24 2001
+++ CMF/CMFCore/interfaces/Discussions.py Fri Dec 20 11:39:21 2002
@@ -10,64 +10,72 @@
# FOR A PARTICULAR PURPOSE
#
##############################################################################
-def HTMLFile( unused ):
- """
- Stub for method loaded from DTML document.
- """
+""" Discussable interface.
-class Discussable:
- """
- Discussable is the interface for things which can have responses.
- It is implemented by PTKBase.Discussions.Discussable. That class
- is designed to mix-in with a PortalContent-derived class. It has
- already been mixed-in with the actual PortalContent class, so at
- present, any PTK object can support replies.
-
- This interface contains some bogosity. Things like replyForm,
- replyPreview and createReply really shouldn't be done here. The
- interface presently assumes that there is only one sort of object
- which the user would ever want to use to create a reply. This is
- a bad assumption, and needs to be addressed!
- """
+$Id$
+"""
- threadView = HTMLFile('...')
- """
- The threadView method should return an HTML page which displays
- this item's children (and optionally parents, though not all
- Discussables can have parents).
+try:
+ from Interface import Interface
+except ImportError:
+ # for Zope versions before 2.6.0
+ from Interface import Base as Interface
- Permission: View
- """
-
- replyForm = HTMLFile('...')
- """
- The replyForm method should return an HTML page which presents an
- interface to enter a reply. It should have buttons for submiting
- the form contents to replyPreview and createReply.
- Permission: Reply to item
+class Discussable(Interface):
+ """ Discussable is the interface for things which can have responses.
"""
- replyPreview = HTMLFile('...')
- """
- This method needs to present the contents submitted from the
- replyForm form with a template similar to what the actual response
- object would use. It should provide submit buttons linked to
- replyForm (for 'Edit') and createReply (for 'Reply').
+ def createReply(title, text, Creator=None):
+ """
+ Create a reply in the proper place.
- Permission: Reply to item
+ Permission: Reply to item
+ Returns: HTML (directly or via redirect)
+ """
+
+ def getReplies():
+ """
+ Return a sequence of the DiscussionResponse objects which are
+ associated with this Discussable
+
+ Permissions: View
+ Returns: sequence of DiscussionResponses
+ """
+
+ def quotedContents():
+ """
+ Return this object's contents in a form suitable for inclusion
+ as a quote in a response. The default implementation returns
+ an empty string. It might be overridden to return a '>' quoted
+ version of the item.
+ """
+
+ def _getReplyResults():
+ """
+ Return the ZCatalog results that represent this object's replies.
+
+ Often, the actual objects are not needed. This is less expensive
+ than fetching the objects.
+
+ Permissions: View
+ Returns: sequence of ZCatalog results representing DiscussionResponses
+ """
+
+
+class OldDiscussable(Interface):
+ """ Oldstyle discussable interface.
"""
-
- def createReply(self, title, text, REQUEST, RESPONSE):
+
+ def createReply(title, text, REQUEST, RESPONSE):
"""
- Create a reply in the proper place. See the next method for more
- information.
+ Create a reply in the proper place.
Permission: Reply to item
Returns: HTML (directly or via redirect)
"""
- def getReplyLocationAndID(self, REQUEST):
+ def getReplyLocationAndID(REQUEST):
"""
This method determines where a user's reply should be stored, and
what it's ID should be.
@@ -89,7 +97,7 @@
Returns: 2-tuple, containing the container object, and a string ID.
"""
- def getReplyResults(self):
+ def getReplyResults():
"""
Return the ZCatalog results that represent this object's replies.
@@ -100,8 +108,7 @@
Returns: sequence of ZCatalog results representing DiscussionResponses
"""
-
- def getReplies(self):
+ def getReplies():
"""
Return a sequence of the DiscussionResponse objects which are
associated with this Discussable
@@ -110,7 +117,7 @@
Returns: sequence of DiscussionResponses
"""
- def quotedContents(self):
+ def quotedContents():
"""
Return this object's contents in a form suitable for inclusion
as a quote in a response. The default implementation returns
@@ -118,27 +125,12 @@
version of the item.
"""
- def allowReplies(self):
- """
- This method must return a logically true value if an object is
- willing to support replies.
- Permissions: None assigned
- Returns: truth value
- """
-
-class DiscussionResponse:
- """
-
- This interface describes the behaviour of a Discussion Response.
- It is implemented in PTKBase.Discussions.DiscussionResponse. This
- implementation is also designed to be mixed together with
- PortalContent. This has been done in the
- PTK.DiscussionItem.DiscussionItem class, which the PTK presently
- uses for all replies.
+class DiscussionResponse(Interface):
+ """ This interface describes the behaviour of a Discussion Response.
"""
- def inReplyTo(self, REQUEST=None):
+ def inReplyTo(REQUEST=None):
"""
Return the Discussable object which this item is associated with
@@ -146,7 +138,7 @@
Returns: a Discussable object
"""
- def setReplyTo(self, reply_to):
+ def setReplyTo(reply_to):
"""
Make this object a response to the passed object. (Will also
accept a path in the form of a string.) If reply_to does not
@@ -157,7 +149,7 @@
Returns: None
"""
- def parentsInThread(self, size=0):
+ def parentsInThread(size=0):
"""
Return the list of object which are this object's parents, from the
point of view of the threaded discussion. Parents are ordered
=== CMF/CMFCore/interfaces/DublinCore.py 1.3 => 1.3.50.1 ===
--- CMF/CMFCore/interfaces/DublinCore.py:1.3 Wed Nov 28 14:06:24 2001
+++ CMF/CMFCore/interfaces/DublinCore.py Fri Dec 20 11:39:21 2002
@@ -10,11 +10,21 @@
# FOR A PARTICULAR PURPOSE
#
##############################################################################
-import Interface
+""" Dublin Core interface.
-class DublinCore(Interface.Base):
+$Id$
+"""
+
+try:
+ from Interface import Interface
+except ImportError:
+ # for Zope versions before 2.6.0
+ from Interface import Base as Interface
+
+
+class DublinCore(Interface):
"""
- Define which Dublin Core metadata elements are supported by the PTK,
+ Define which Dublin Core metadata elements are supported by the CMF,
and the semantics therof.
"""
@@ -172,7 +182,7 @@
Permissions: View
"""
-class CatalogableDublinCore(Interface.Base):
+class CatalogableDublinCore(Interface):
"""
Provide Zope-internal date objects for cataloging purposes.
"""
@@ -208,7 +218,7 @@
Permissions: View
"""
-class MutableDublinCore(Interface.Base):
+class MutableDublinCore(Interface):
"""
Update interface for mutable metadata.
"""
=== CMF/CMFCore/interfaces/Syndicatable.py 1.2 => 1.2.50.1 ===
--- CMF/CMFCore/interfaces/Syndicatable.py:1.2 Wed Nov 28 14:06:24 2001
+++ CMF/CMFCore/interfaces/Syndicatable.py Fri Dec 20 11:39:21 2002
@@ -10,12 +10,19 @@
# FOR A PARTICULAR PURPOSE
#
##############################################################################
-"""\
-Declare interface for synContentValues
+""" Syndicatable interface.
+
+$Id$
"""
-import Interface
-class Syndicatable(Interface.Base):
+try:
+ from Interface import Interface
+except ImportError:
+ # for Zope versions before 2.6.0
+ from Interface import Base as Interface
+
+
+class Syndicatable(Interface):
"""\
Returns back a list of objects which implements the DublinCore.
"""
=== CMF/CMFCore/interfaces/portal_catalog.py 1.6.12.1 => 1.6.12.2 ===
--- CMF/CMFCore/interfaces/portal_catalog.py:1.6.12.1 Thu Dec 19 17:09:03 2002
+++ CMF/CMFCore/interfaces/portal_catalog.py Fri Dec 20 11:39:21 2002
@@ -59,3 +59,14 @@
def getpath(data_record_id_):
'''Calls ZCatalog.getpath().
'''
+
+
+class IndexableObjectWrapper(Interface):
+ """ Indexable object wrapper interface.
+ """
+
+ def allowedRolesAndUsers():
+ """
+ Return a list of roles and users with View permission.
+ Used by PortalCatalog to filter out items you're not allowed to see.
+ """