[CMF-checkins] CVS: CMF/CMFCore - CatalogTool.py:1.37.8.3 ContentTypeRegistry.py:1.11.12.1 DiscussionTool.py:1.8.12.2 DynamicType.py:1.13.12.1 PortalContent.py:1.39.12.1

Yvo Schubbe schubbe@web.de
Fri, 20 Dec 2002 11:39:00 -0500


Update of /cvs-repository/CMF/CMFCore
In directory cvs.zope.org:/tmp/cvs-serv21105/CMFCore

Modified Files:
      Tag: yuppie-collector096-branch
	CatalogTool.py ContentTypeRegistry.py DiscussionTool.py 
	DynamicType.py PortalContent.py 
Log Message:
more interface cleanups:
- added interface tests and made them pass

=== CMF/CMFCore/CatalogTool.py 1.37.8.2 => 1.37.8.3 ===
--- CMF/CMFCore/CatalogTool.py:1.37.8.2	Thu Dec 19 17:08:51 2002
+++ CMF/CMFCore/CatalogTool.py	Fri Dec 20 11:38:59 2002
@@ -34,10 +34,14 @@
 from CMFCorePermissions import AccessInactivePortalContent
 from Acquisition import aq_base
 
+from interfaces.portal_catalog \
+        import IndexableObjectWrapper as IIndexableObjectWrapper
 from interfaces.portal_catalog import portal_catalog as ICatalogTool
 
 
 class IndexableObjectWrapper:
+
+    __implements__ = IIndexableObjectWrapper
 
     def __init__(self, vars, ob):
         self.__vars = vars


=== CMF/CMFCore/ContentTypeRegistry.py 1.11 => 1.11.12.1 ===
--- CMF/CMFCore/ContentTypeRegistry.py:1.11	Sat Aug  3 22:38:35 2002
+++ CMF/CMFCore/ContentTypeRegistry.py	Fri Dec 20 11:38:59 2002
@@ -25,11 +25,20 @@
 
 import re, os, string, urllib
 
+from interfaces.ContentTypeRegistry \
+        import ContentTypeRegistryPredicate as IContentTypeRegistryPredicate
+from interfaces.ContentTypeRegistry \
+        import ContentTypeRegistry as IContentTypeRegistry
+
+
 class MajorMinorPredicate( SimpleItem ):
     """
         Predicate matching on 'major/minor' content types.
         Empty major or minor implies wildcard (all match).
     """
+
+    __implements__ = IContentTypeRegistryPredicate
+
     major = minor = None
     PREDICATE_TYPE  = 'major_minor'
 
@@ -74,10 +83,11 @@
     #   ContentTypeRegistryPredicate interface
     #
     security.declareObjectPublic()
-    def __call__( self, name, typ, body, SLASH_SPLIT=re.compile( '/' ) ):
+    def __call__( self, name, typ, body ):
         """
             Return true if the rule matches, else false.
         """
+        SLASH_SPLIT = re.compile( '/' )
         if self.major is None:
             return 0
 
@@ -113,6 +123,9 @@
     """
         Predicate matching on filename extensions.
     """
+
+    __implements__ = IContentTypeRegistryPredicate
+
     extensions = None
     PREDICATE_TYPE  = 'extension'
 
@@ -174,6 +187,9 @@
         string patterns (other objects conforming to 'match' can
         also be passed).
     """
+
+    __implements__ = IContentTypeRegistryPredicate
+
     pattern         = None
     PREDICATE_TYPE  = 'mimetype_regex'
 
@@ -227,6 +243,9 @@
         for string patterns (other objects conforming to 'match'
         and 'pattern' can also be passed).
     """
+
+    __implements__ = IContentTypeRegistryPredicate
+
     pattern         = None
     PREDICATE_TYPE  = 'name_regex'
 
@@ -298,6 +317,9 @@
     """
         Registry for rules which map PUT args to a CMF Type Object.
     """
+
+    __implements__ = IContentTypeRegistry
+
     meta_type = 'Content Type Registry'
     id = 'content_type_registry'
 


=== CMF/CMFCore/DiscussionTool.py 1.8.12.1 => 1.8.12.2 ===
--- CMF/CMFCore/DiscussionTool.py:1.8.12.1	Thu Dec 19 17:08:51 2002
+++ CMF/CMFCore/DiscussionTool.py	Fri Dec 20 11:38:59 2002
@@ -26,6 +26,7 @@
 import Acquisition
 from AccessControl import ClassSecurityInfo
 
+from interfaces.Discussions import OldDiscussable as IOldDiscussable
 from interfaces.portal_discussion \
         import oldstyle_portal_discussion as IOldstyleDiscussionTool
 
@@ -34,6 +35,8 @@
     """
         Adapter for PortalContent to implement "old-style" discussions.
     """
+
+    __implements__ = IOldDiscussable
 
     _isDiscussable = 1
 


=== CMF/CMFCore/DynamicType.py 1.13 => 1.13.12.1 ===
--- CMF/CMFCore/DynamicType.py:1.13	Sun Aug  4 19:10:59 2002
+++ CMF/CMFCore/DynamicType.py	Fri Dec 20 11:38:59 2002
@@ -20,12 +20,17 @@
 import Globals
 from urllib import quote
 
+from interfaces.Dynamic import DynamicType as IDynamicType
+
 
 class DynamicType:
     """
     Mixin for portal content that allows the object to take on
     a dynamic type property.
     """
+
+    __implements__ = IDynamicType
+
     portal_type = None
 
     security = ClassSecurityInfo()


=== CMF/CMFCore/PortalContent.py 1.39 => 1.39.12.1 ===
--- CMF/CMFCore/PortalContent.py:1.39	Sat Aug  3 22:31:30 2002
+++ CMF/CMFCore/PortalContent.py	Fri Dec 20 11:39:00 2002
@@ -55,9 +55,12 @@
     """
     
     if not NoWL:
-        __implements__ = (WriteLockInterface, Contentish,)
+        __implements__ = (WriteLockInterface
+                         ,Contentish
+                         ,DynamicType.__implements__)
     else:
-        __implements__ = (Contentish)
+        __implements__ = (Contentish, DynamicType.__implements__)
+
     isPortalContent = 1
     _isPortalContent = 1  # More reliable than 'isPortalContent'.
 
@@ -93,17 +96,16 @@
             raise ResourceLockedError, 'This resource is locked via webDAV'
         return 0
 
-    # indexed methods
-    # ---------------
-    
+    #
+    #   Contentish interface methods
+    #
     security.declareProtected(View, 'SearchableText')
     def SearchableText(self):
-        "Returns a concatination of all searchable text"
-        # Should be overriden by portal objects
-        return "%s %s" % (self.Title(), self.Description())
+        """ Returns a concatination of all searchable text.
 
-    # Contentish interface methods
-    # ----------------------------
+        Should be overriden by portal objects.
+        """
+        return "%s %s" % (self.Title(), self.Description())
 
     def __call__(self):
         '''