[CMF-checkins] SVN: CMF/trunk/ merged goldegg-phase-1 branch back to trunk:

Yvo Schubbe y.2005- at wcm-solutions.de
Sat Sep 24 11:24:33 EDT 2005


Log message for revision 38590:
  merged goldegg-phase-1 branch back to trunk:
  - landing GenericSetup
  - switching to z3 interfaces, deprecating the old ones

Changed:
  U   CMF/trunk/CMFCore/ActionInformation.py
  U   CMF/trunk/CMFCore/ActionProviderBase.py
  U   CMF/trunk/CMFCore/ActionsTool.py
  U   CMF/trunk/CMFCore/CMFCatalogAware.py
  U   CMF/trunk/CMFCore/CachingPolicyManager.py
  U   CMF/trunk/CMFCore/CatalogTool.py
  U   CMF/trunk/CMFCore/ContentTypeRegistry.py
  U   CMF/trunk/CMFCore/DiscussionTool.py
  U   CMF/trunk/CMFCore/DynamicType.py
  U   CMF/trunk/CMFCore/MemberDataTool.py
  U   CMF/trunk/CMFCore/MembershipTool.py
  U   CMF/trunk/CMFCore/PortalContent.py
  U   CMF/trunk/CMFCore/PortalFolder.py
  U   CMF/trunk/CMFCore/RegistrationTool.py
  U   CMF/trunk/CMFCore/SkinsContainer.py
  U   CMF/trunk/CMFCore/SkinsTool.py
  U   CMF/trunk/CMFCore/TypesTool.py
  U   CMF/trunk/CMFCore/URLTool.py
  U   CMF/trunk/CMFCore/UndoTool.py
  U   CMF/trunk/CMFCore/WorkflowTool.py
  D   CMF/trunk/CMFCore/bridge.zcml
  D   CMF/trunk/CMFCore/configure.zcml
  D   CMF/trunk/CMFCore/implements.zcml
  U   CMF/trunk/CMFCore/interfaces/CachingPolicyManager.py
  U   CMF/trunk/CMFCore/interfaces/ContentTypeRegistry.py
  U   CMF/trunk/CMFCore/interfaces/Contentish.py
  U   CMF/trunk/CMFCore/interfaces/Discussions.py
  U   CMF/trunk/CMFCore/interfaces/DublinCore.py
  U   CMF/trunk/CMFCore/interfaces/Dynamic.py
  U   CMF/trunk/CMFCore/interfaces/Folderish.py
  U   CMF/trunk/CMFCore/interfaces/IOpaqueItems.py
  U   CMF/trunk/CMFCore/interfaces/Syndicatable.py
  U   CMF/trunk/CMFCore/interfaces/__init__.py
  A   CMF/trunk/CMFCore/interfaces/_content.py
  A   CMF/trunk/CMFCore/interfaces/_tools.py
  U   CMF/trunk/CMFCore/interfaces/portal_actions.py
  U   CMF/trunk/CMFCore/interfaces/portal_catalog.py
  U   CMF/trunk/CMFCore/interfaces/portal_discussion.py
  U   CMF/trunk/CMFCore/interfaces/portal_memberdata.py
  U   CMF/trunk/CMFCore/interfaces/portal_membership.py
  U   CMF/trunk/CMFCore/interfaces/portal_metadata.py
  U   CMF/trunk/CMFCore/interfaces/portal_properties.py
  U   CMF/trunk/CMFCore/interfaces/portal_registration.py
  U   CMF/trunk/CMFCore/interfaces/portal_skins.py
  U   CMF/trunk/CMFCore/interfaces/portal_types.py
  U   CMF/trunk/CMFCore/interfaces/portal_undo.py
  U   CMF/trunk/CMFCore/interfaces/portal_url.py
  U   CMF/trunk/CMFCore/interfaces/portal_workflow.py
  U   CMF/trunk/CMFDefault/DefaultWorkflow.py
  U   CMF/trunk/CMFDefault/DiscussionItem.py
  U   CMF/trunk/CMFDefault/DiscussionTool.py
  U   CMF/trunk/CMFDefault/Document.py
  U   CMF/trunk/CMFDefault/DublinCore.py
  U   CMF/trunk/CMFDefault/MembershipTool.py
  U   CMF/trunk/CMFDefault/MetadataTool.py
  U   CMF/trunk/CMFDefault/PropertiesTool.py
  D   CMF/trunk/CMFDefault/bridge.zcml
  U   CMF/trunk/CMFDefault/configure.zcml
  D   CMF/trunk/CMFDefault/implements.zcml
  U   CMF/trunk/CMFDefault/interfaces/Document.py
  U   CMF/trunk/CMFDefault/interfaces/__init__.py
  A   CMF/trunk/CMFDefault/interfaces/_content.py
  A   CMF/trunk/CMFDefault/interfaces/_tools.py
  U   CMF/trunk/CMFDefault/interfaces/portal_membership.py
  U   CMF/trunk/CMFSetup/actions.py
  U   CMF/trunk/CMFSetup/context.py
  U   CMF/trunk/CMFSetup/differ.py
  U   CMF/trunk/CMFSetup/interfaces.py
  U   CMF/trunk/CMFSetup/registry.py
  U   CMF/trunk/CMFSetup/rolemap.py
  D   CMF/trunk/CMFSetup/tests/conformance.py
  D   CMF/trunk/CMFSetup/tests/test_context.py
  D   CMF/trunk/CMFSetup/tests/test_differ.py
  D   CMF/trunk/CMFSetup/tests/test_registry.py
  D   CMF/trunk/CMFSetup/tests/test_rolemap.py
  D   CMF/trunk/CMFSetup/tests/test_tool.py
  U   CMF/trunk/CMFSetup/tool.py
  U   CMF/trunk/CMFTopic/DateCriteria.py
  U   CMF/trunk/CMFTopic/ListCriterion.py
  U   CMF/trunk/CMFTopic/SimpleIntCriterion.py
  U   CMF/trunk/CMFTopic/SimpleStringCriterion.py
  U   CMF/trunk/CMFTopic/SortCriterion.py
  D   CMF/trunk/CMFTopic/configure.zcml
  U   CMF/trunk/CMFTopic/interfaces/Criterion.py
  U   CMF/trunk/CMFTopic/interfaces/__init__.py
  U   CMF/trunk/CMFUid/UniqueIdAnnotationTool.py
  U   CMF/trunk/CMFUid/UniqueIdGeneratorTool.py
  U   CMF/trunk/CMFUid/UniqueIdHandlerTool.py
  U   CMF/trunk/CMFUid/interfaces.py
  U   CMF/trunk/CMFUid/tests/test_uidannotation.py
  U   CMF/trunk/CMFUid/tests/test_uidgeneration.py
  U   CMF/trunk/CMFUid/tests/test_uidhandling.py
  U   CMF/trunk/DCWorkflow/DCWorkflow.py
  D   CMF/trunk/DCWorkflow/configure.zcml
  A   CMF/trunk/GenericSetup/

-=-
Modified: CMF/trunk/CMFCore/ActionInformation.py
===================================================================
--- CMF/trunk/CMFCore/ActionInformation.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFCore/ActionInformation.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -25,11 +25,15 @@
 from OFS.SimpleItem import SimpleItem
 from Products.PageTemplates.PageTemplateFile import PageTemplateFile
 from zope.i18nmessageid import MessageID
+from zope.interface import implements
 
 from Expression import Expression
-from interfaces.portal_actions import Action as IAction
-from interfaces.portal_actions import ActionCategory as IActionCategory
-from interfaces.portal_actions import ActionInfo as IActionInfo
+from interfaces import IAction
+from interfaces import IActionCategory
+from interfaces import IActionInfo
+from interfaces.portal_actions import Action as z2IAction
+from interfaces.portal_actions import ActionCategory as z2IActionCategory
+from interfaces.portal_actions import ActionInfo as z2IActionInfo
 from permissions import View
 from utils import _checkPermission
 from utils import _wwwdir
@@ -43,11 +47,12 @@
     """ Group of Action objects.
     """
 
-    __implements__ = (IActionCategory, OrderedFolder.__implements__)
+    implements(IActionCategory)
+    __implements__ = (z2IActionCategory, OrderedFolder.__implements__)
 
     meta_type = 'CMF Action Category'
 
-    _product_interfaces = (IActionCategory, IAction)
+    _product_interfaces = (z2IActionCategory, z2IAction)
 
     security = ClassSecurityInfo()
 
@@ -58,9 +63,9 @@
         actions = []
 
         for obj in self.objectValues():
-            if IActionCategory.isImplementedBy(obj):
+            if z2IActionCategory.isImplementedBy(obj):
                 actions.extend( obj.listActions() )
-            elif IAction.isImplementedBy(obj):
+            elif z2IAction.isImplementedBy(obj):
                 actions.append(obj)
 
         return tuple(actions)
@@ -84,7 +89,8 @@
     """ Reference to an action.
     """
 
-    __implements__ = IAction
+    implements(IAction)
+    __implements__ = z2IAction
 
     meta_type = 'CMF Action'
     i18n_domain = 'cmf_default'
@@ -179,7 +185,8 @@
     """ A lazy dictionary for Action infos.
     """
 
-    __implements__ = IActionInfo
+    implements(IActionInfo)
+    __implements__ = z2IActionInfo
 
     __allow_access_to_unprotected_subobjects__ = 1
 
@@ -265,7 +272,8 @@
     of the site.  They can be filtered via their conditions.
     """
 
-    __implements__ = IAction
+    implements(IAction)
+    __implements__ = z2IAction
 
     _isActionInformation = 1
     __allow_access_to_unprotected_subobjects__ = 1

Modified: CMF/trunk/CMFCore/ActionProviderBase.py
===================================================================
--- CMF/trunk/CMFCore/ActionProviderBase.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFCore/ActionProviderBase.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -18,13 +18,15 @@
 from AccessControl import ClassSecurityInfo
 from Globals import DTMLFile
 from Globals import InitializeClass
+from zope.interface import implements
 
 from ActionInformation import ActionInfo
 from ActionInformation import ActionInformation
 from ActionInformation import getOAI
 from exceptions import AccessControl_Unauthorized
 from Expression import getExprContext
-from interfaces.portal_actions import ActionProvider as IActionProvider
+from interfaces import IActionProvider
+from interfaces.portal_actions import ActionProvider as z2IActionProvider
 from permissions import ManagePortal
 from utils import _dtmldir
 
@@ -33,7 +35,8 @@
     """ Provide ActionTabs and management methods for ActionProviders
     """
 
-    __implements__ = IActionProvider
+    implements(IActionProvider)
+    __implements__ = z2IActionProvider
 
     security = ClassSecurityInfo()
 

Modified: CMF/trunk/CMFCore/ActionsTool.py
===================================================================
--- CMF/trunk/CMFCore/ActionsTool.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFCore/ActionsTool.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -20,11 +20,13 @@
 from Globals import InitializeClass
 from OFS.ObjectManager import IFAwareObjectManager
 from OFS.OrderedFolder import OrderedFolder
+from zope.interface import implements
 
 from ActionProviderBase import ActionProviderBase
-from interfaces.portal_actions import ActionCategory as IActionCategory
-from interfaces.portal_actions import ActionProvider as IActionProvider
-from interfaces.portal_actions import portal_actions as IActionsTool
+from interfaces import IActionsTool
+from interfaces.portal_actions import ActionCategory as z2IActionCategory
+from interfaces.portal_actions import ActionProvider as z2IActionProvider
+from interfaces.portal_actions import portal_actions as z2IActionsTool
 from permissions import ManagePortal
 from utils import _dtmldir
 from utils import UniqueObject
@@ -38,12 +40,13 @@
         to the current user and context.
     """
 
-    __implements__ = (IActionsTool, OrderedFolder.__implements__,
+    implements(IActionsTool)
+    __implements__ = (z2IActionsTool, OrderedFolder.__implements__,
                       ActionProviderBase.__implements__)
 
     id = 'portal_actions'
     meta_type = 'CMF Actions Tool'
-    _product_interfaces = (IActionCategory,)
+    _product_interfaces = (z2IActionCategory,)
     action_providers = ('portal_types', 'portal_workflow', 'portal_actions')
 
     security = ClassSecurityInfo()
@@ -154,12 +157,12 @@
         # Include actions from specific tools.
         for provider_name in self.listActionProviders():
             provider = getattr(self, provider_name)
-            if IActionProvider.isImplementedBy(provider):
+            if z2IActionProvider.isImplementedBy(provider):
                 actions.extend( provider.listActionInfos(object=object) )
 
         # Include actions from object.
         if object is not None:
-            if IActionProvider.isImplementedBy(object):
+            if z2IActionProvider.isImplementedBy(object):
                 actions.extend( object.listActionInfos(object=object) )
 
         # Reorganize the actions by category.

Modified: CMF/trunk/CMFCore/CMFCatalogAware.py
===================================================================
--- CMF/trunk/CMFCore/CMFCatalogAware.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFCore/CMFCatalogAware.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -29,7 +29,9 @@
 from utils import _getAuthenticatedUser
 from utils import getToolByName
 
-from interfaces.IOpaqueItems import ICallableOpaqueItem
+from interfaces import ICallableOpaqueItem
+from interfaces.IOpaqueItems \
+        import ICallableOpaqueItem as z2ICallableOpaqueItem
 
 class CMFCatalogAware(Base):
     """Mix-in for notifying portal_catalog and portal_workflow
@@ -162,7 +164,8 @@
         self_base = aq_base(self)
         for name in self_base.__dict__.keys():
             obj = getattr(self_base, name)
-            if ICallableOpaqueItem.isImplementedBy(obj):
+            if ICallableOpaqueItem.providedBy(obj) \
+                    or z2ICallableOpaqueItem.isImplementedBy(obj):
                 items.append((obj.getId(), obj))
 
         return tuple(items)

Modified: CMF/trunk/CMFCore/CachingPolicyManager.py
===================================================================
--- CMF/trunk/CMFCore/CachingPolicyManager.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFCore/CachingPolicyManager.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -24,12 +24,14 @@
 from OFS.SimpleItem import SimpleItem
 from Products.PageTemplates.Expressions import getEngine
 from Products.PageTemplates.Expressions import SecureModuleImporter
+from zope.interface import implements
 
 from permissions import ManagePortal
 from permissions import View
 from Expression import Expression
+from interfaces import ICachingPolicyManager
 from interfaces.CachingPolicyManager \
-        import CachingPolicyManager as ICachingPolicyManager
+        import CachingPolicyManager as z2ICachingPolicyManager
 from utils import _dtmldir
 from utils import getToolByName
 
@@ -335,7 +337,8 @@
         to them from skin methods.
     """
 
-    __implements__ = ICachingPolicyManager
+    implements(ICachingPolicyManager)
+    __implements__ = z2ICachingPolicyManager
 
     id = 'caching_policy_manager'
     meta_type = 'CMF Caching Policy Manager'

Modified: CMF/trunk/CMFCore/CatalogTool.py
===================================================================
--- CMF/trunk/CMFCore/CatalogTool.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFCore/CatalogTool.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -26,11 +26,14 @@
 from Products.ZCTextIndex.Lexicon import Splitter
 from Products.ZCTextIndex.Lexicon import StopWordRemover
 from Products.ZCTextIndex.ZCTextIndex import PLexicon
+from zope.interface import implements
 
 from ActionProviderBase import ActionProviderBase
+from interfaces import ICatalogTool
+from interfaces import IIndexableObjectWrapper
 from interfaces.portal_catalog \
-        import IndexableObjectWrapper as IIndexableObjectWrapper
-from interfaces.portal_catalog import portal_catalog as ICatalogTool
+        import IndexableObjectWrapper as z2IIndexableObjectWrapper
+from interfaces.portal_catalog import portal_catalog as z2ICatalogTool
 from permissions import AccessInactivePortalContent
 from permissions import ManagePortal
 from permissions import View
@@ -45,7 +48,8 @@
 
 class IndexableObjectWrapper:
 
-    __implements__ = IIndexableObjectWrapper
+    implements(IIndexableObjectWrapper)
+    __implements__ = z2IIndexableObjectWrapper
 
     def __init__(self, vars, ob):
         self.__vars = vars
@@ -81,7 +85,8 @@
     """ This is a ZCatalog that filters catalog queries.
     """
 
-    __implements__ = (ICatalogTool, ZCatalog.__implements__,
+    implements(ICatalogTool)
+    __implements__ = (z2ICatalogTool, ZCatalog.__implements__,
                       ActionProviderBase.__implements__)
 
     id = 'portal_catalog'

Modified: CMF/trunk/CMFCore/ContentTypeRegistry.py
===================================================================
--- CMF/trunk/CMFCore/ContentTypeRegistry.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFCore/ContentTypeRegistry.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -23,11 +23,14 @@
 from Globals import PersistentMapping
 from OFS.SimpleItem import SimpleItem
 from ZPublisher.mapply import mapply
+from zope.interface import implements
 
+from interfaces import IContentTypeRegistry
+from interfaces import IContentTypeRegistryPredicate
 from interfaces.ContentTypeRegistry \
-        import ContentTypeRegistry as IContentTypeRegistry
+        import ContentTypeRegistry as z2IContentTypeRegistry
 from interfaces.ContentTypeRegistry \
-        import ContentTypeRegistryPredicate as IContentTypeRegistryPredicate
+        import ContentTypeRegistryPredicate as z2IContentTypeRegistryPredicate
 from permissions import ManagePortal
 from utils import _dtmldir
 from utils import getToolByName
@@ -39,7 +42,8 @@
         Empty major or minor implies wildcard (all match).
     """
 
-    __implements__ = IContentTypeRegistryPredicate
+    implements(IContentTypeRegistryPredicate)
+    __implements__ = z2IContentTypeRegistryPredicate
 
     major = minor = None
     PREDICATE_TYPE  = 'major_minor'
@@ -125,7 +129,8 @@
         Predicate matching on filename extensions.
     """
 
-    __implements__ = IContentTypeRegistryPredicate
+    implements(IContentTypeRegistryPredicate)
+    __implements__ = z2IContentTypeRegistryPredicate
 
     extensions = None
     PREDICATE_TYPE  = 'extension'
@@ -189,7 +194,8 @@
         also be passed).
     """
 
-    __implements__ = IContentTypeRegistryPredicate
+    implements(IContentTypeRegistryPredicate)
+    __implements__ = z2IContentTypeRegistryPredicate
 
     pattern         = None
     PREDICATE_TYPE  = 'mimetype_regex'
@@ -245,7 +251,8 @@
         and 'pattern' can also be passed).
     """
 
-    __implements__ = IContentTypeRegistryPredicate
+    implements(IContentTypeRegistryPredicate)
+    __implements__ = z2IContentTypeRegistryPredicate
 
     pattern         = None
     PREDICATE_TYPE  = 'name_regex'
@@ -319,7 +326,8 @@
         Registry for rules which map PUT args to a CMF Type Object.
     """
 
-    __implements__ = IContentTypeRegistry
+    implements(IContentTypeRegistry)
+    __implements__ = z2IContentTypeRegistry
 
     meta_type = 'Content Type Registry'
     id = 'content_type_registry'

Modified: CMF/trunk/CMFCore/DiscussionTool.py
===================================================================
--- CMF/trunk/CMFCore/DiscussionTool.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFCore/DiscussionTool.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -19,15 +19,18 @@
 from Globals import InitializeClass, DTMLFile
 from Acquisition import Implicit
 from AccessControl import ClassSecurityInfo
+from zope.interface import implements
 
 from ActionProviderBase import ActionProviderBase
 from permissions import AccessContentsInformation
 from permissions import ManagePortal
 from permissions import ReplyToItem
 from permissions import View
-from interfaces.Discussions import OldDiscussable as IOldDiscussable
+from interfaces import IOldstyleDiscussable
+from interfaces import IOldstyleDiscussionTool
+from interfaces.Discussions import OldDiscussable as z2IOldstyleDiscussable
 from interfaces.portal_discussion \
-        import oldstyle_portal_discussion as IOldstyleDiscussionTool
+        import oldstyle_portal_discussion as z2IOldstyleDiscussionTool
 from utils import _dtmldir
 from utils import getToolByName
 from utils import UniqueObject
@@ -38,7 +41,8 @@
         Adapter for PortalContent to implement "old-style" discussions.
     """
 
-    __implements__ = IOldDiscussable
+    implements(IOldstyleDiscussable)
+    __implements__ = z2IOldstyleDiscussable
 
     _isDiscussable = 1
 
@@ -112,9 +116,10 @@
         return ""
 
 
-class DiscussionTool (UniqueObject, SimpleItem, ActionProviderBase):
+class DiscussionTool(UniqueObject, SimpleItem, ActionProviderBase):
 
-    __implements__ = (IOldstyleDiscussionTool,
+    implements(IOldstyleDiscussionTool)
+    __implements__ = (z2IOldstyleDiscussionTool,
                       ActionProviderBase.__implements__)
 
     id = 'portal_discussion'

Modified: CMF/trunk/CMFCore/DynamicType.py
===================================================================
--- CMF/trunk/CMFCore/DynamicType.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFCore/DynamicType.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -19,18 +19,22 @@
 
 from AccessControl import ClassSecurityInfo
 from Globals import InitializeClass
+from zope.interface import implements
 
-from interfaces.Dynamic import DynamicType as IDynamicType
+from interfaces import IDynamicType
+from interfaces.Dynamic import DynamicType as z2IDynamicType
 from utils import getToolByName
 
 
 class DynamicType:
+
     """
     Mixin for portal content that allows the object to take on
     a dynamic type property.
     """
 
-    __implements__ = IDynamicType
+    implements(IDynamicType)
+    __implements__ = z2IDynamicType
 
     portal_type = None
 

Modified: CMF/trunk/CMFCore/MemberDataTool.py
===================================================================
--- CMF/trunk/CMFCore/MemberDataTool.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFCore/MemberDataTool.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -23,11 +23,15 @@
 from OFS.PropertyManager import PropertyManager
 from OFS.SimpleItem import SimpleItem
 from ZPublisher.Converters import type_converters
+from zope.interface import implements
 
 from ActionProviderBase import ActionProviderBase
 from exceptions import BadRequest
-from interfaces.portal_memberdata import MemberData as IMemberData
-from interfaces.portal_memberdata import portal_memberdata as IMemberDataTool
+from interfaces import IMemberData
+from interfaces import IMemberDataTool
+from interfaces.portal_memberdata import MemberData as z2IMemberData
+from interfaces.portal_memberdata \
+        import portal_memberdata as z2IMemberDataTool
 from permissions import ManagePortal
 from permissions import SetOwnProperties
 from permissions import ViewManagementScreens
@@ -45,7 +49,8 @@
     """ This tool wraps user objects, making them act as Member objects.
     """
 
-    __implements__ = (IMemberDataTool, ActionProviderBase.__implements__)
+    implements(IMemberDataTool)
+    __implements__ = (z2IMemberDataTool, ActionProviderBase.__implements__)
 
     id = 'portal_memberdata'
     meta_type = 'CMF Member Data Tool'
@@ -247,9 +252,10 @@
             pass
 
 
-class MemberData (SimpleItem):
+class MemberData(SimpleItem):
 
-    __implements__ = IMemberData
+    implements(IMemberData)
+    __implements__ = z2IMemberData
 
     security = ClassSecurityInfo()
 

Modified: CMF/trunk/CMFCore/MembershipTool.py
===================================================================
--- CMF/trunk/CMFCore/MembershipTool.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFCore/MembershipTool.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -26,12 +26,14 @@
 from Globals import PersistentMapping
 from OFS.Folder import Folder
 from ZODB.POSException import ConflictError
+from zope.interface import implements
 
 from ActionProviderBase import ActionProviderBase
 from exceptions import AccessControl_Unauthorized
 from exceptions import BadRequest
+from interfaces import IMembershipTool
 from interfaces.portal_membership \
-        import portal_membership as IMembershipTool
+        import portal_membership as z2IMembershipTool
 from permissions import AccessContentsInformation
 from permissions import ChangeLocalRoles
 from permissions import ListPortalMembers
@@ -54,7 +56,8 @@
     different way.
     """
 
-    __implements__ = (IMembershipTool, ActionProviderBase.__implements__)
+    implements(IMembershipTool)
+    __implements__ = (z2IMembershipTool, ActionProviderBase.__implements__)
 
     id = 'portal_membership'
     meta_type = 'CMF Membership Tool'

Modified: CMF/trunk/CMFCore/PortalContent.py
===================================================================
--- CMF/trunk/CMFCore/PortalContent.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFCore/PortalContent.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -19,30 +19,31 @@
 from Acquisition import aq_base
 from OFS.SimpleItem import SimpleItem
 from AccessControl import ClassSecurityInfo
-from webdav.WriteLockInterface import WriteLockInterface
+from webdav.WriteLockInterface import WriteLockInterface as z2IWriteLock
+from zope.interface import implements
 
-from interfaces.Contentish import Contentish
+from CMFCatalogAware import CMFCatalogAware
 from DynamicType import DynamicType
-from CMFCatalogAware import CMFCatalogAware
 from exceptions import NotFound
 from exceptions import ResourceLockedError
+from interfaces import IContentish
+from interfaces.Contentish import Contentish as z2IContentish
 from permissions import FTPAccess
 from permissions import View
 
 
 class PortalContent(DynamicType, CMFCatalogAware, SimpleItem):
-    """
-        Base class for portal objects.
 
+    """ Base class for portal objects.
+
         Provides hooks for reviewing, indexing, and CMF UI.
 
         Derived classes must implement the interface described in
         interfaces/DublinCore.py.
     """
 
-    __implements__ = (Contentish,
-                      WriteLockInterface,
-                      DynamicType.__implements__)
+    implements(IContentish)
+    __implements__ = (z2IContentish, z2IWriteLock, DynamicType.__implements__)
 
     isPortalContent = 1
     _isPortalContent = 1  # More reliable than 'isPortalContent'.

Modified: CMF/trunk/CMFCore/PortalFolder.py
===================================================================
--- CMF/trunk/CMFCore/PortalFolder.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFCore/PortalFolder.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -26,13 +26,15 @@
 from Globals import InitializeClass
 from OFS.OrderSupport import OrderSupport
 from OFS.Folder import Folder
+from zope.interface import implements
 
 from CMFCatalogAware import CMFCatalogAware
 from DynamicType import DynamicType
 from exceptions import AccessControl_Unauthorized
 from exceptions import BadRequest
 from exceptions import zExceptions_Unauthorized
-from interfaces.Folderish import Folderish as IFolderish
+from interfaces import IFolderish
+from interfaces.Folderish import Folderish as z2IFolderish
 from permissions import AddPortalContent
 from permissions import AddPortalFolders
 from permissions import ChangeLocalRoles
@@ -97,11 +99,13 @@
 
 
 class PortalFolderBase(DynamicType, CMFCatalogAware, Folder):
+
     """Base class for portal folder
     """
     meta_type = 'Portal Folder Base'
 
-    __implements__ = (IFolderish, DynamicType.__implements__,
+    implements(IFolderish)
+    __implements__ = (z2IFolderish, DynamicType.__implements__,
                       Folder.__implements__)
 
     security = ClassSecurityInfo()

Modified: CMF/trunk/CMFCore/RegistrationTool.py
===================================================================
--- CMF/trunk/CMFCore/RegistrationTool.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFCore/RegistrationTool.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -22,10 +22,12 @@
 from Globals import DTMLFile
 from Globals import InitializeClass
 from OFS.SimpleItem import SimpleItem
+from zope.interface import implements
 
 from ActionProviderBase import ActionProviderBase
+from interfaces import IRegistrationTool
 from interfaces.portal_registration \
-        import portal_registration as IRegistrationTool
+        import portal_registration as z2IRegistrationTool
 from permissions import AddPortalMember
 from permissions import MailForgottenPassword
 from permissions import ManagePortal
@@ -42,7 +44,8 @@
     """ Create and modify users by making calls to portal_membership.
     """
 
-    __implements__ = (IRegistrationTool, ActionProviderBase.__implements__)
+    implements(IRegistrationTool)
+    __implements__ = (z2IRegistrationTool, ActionProviderBase.__implements__)
 
     id = 'portal_registration'
     meta_type = 'CMF Registration Tool'

Modified: CMF/trunk/CMFCore/SkinsContainer.py
===================================================================
--- CMF/trunk/CMFCore/SkinsContainer.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFCore/SkinsContainer.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -18,15 +18,18 @@
 from AccessControl import ClassSecurityInfo
 from Acquisition import aq_base
 from Globals import InitializeClass
+from zope.interface import implements
 
 from exceptions import SkinPathError
-from interfaces.portal_skins import SkinsContainer as ISkinsContainer
+from interfaces import ISkinsContainer
+from interfaces.portal_skins import SkinsContainer as z2ISkinsContainer
 from permissions import AccessContentsInformation
 
 
 class SkinsContainer:
 
-    __implements__ = ISkinsContainer
+    implements(ISkinsContainer)
+    __implements__ = z2ISkinsContainer
 
     security = ClassSecurityInfo()
 

Modified: CMF/trunk/CMFCore/SkinsTool.py
===================================================================
--- CMF/trunk/CMFCore/SkinsTool.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFCore/SkinsTool.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -27,12 +27,14 @@
 from OFS.ObjectManager import REPLACEABLE
 from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate
 from Products.PythonScripts.PythonScript import PythonScript
+from zope.interface import implements
 
 from ActionProviderBase import ActionProviderBase
 from DirectoryView import base_ignore
 from DirectoryView import ignore
 from DirectoryView import ignore_re
-from interfaces.portal_skins import portal_skins as ISkinsTool
+from interfaces import ISkinsTool
+from interfaces.portal_skins import portal_skins as z2ISkinsTool
 from permissions import AccessContentsInformation
 from permissions import ManagePortal
 from permissions import View
@@ -60,7 +62,8 @@
     """ This tool is used to supply skins to a portal.
     """
 
-    __implements__ = (ISkinsTool, SkinsContainer.__implements__,
+    implements(ISkinsTool)
+    __implements__ = (z2ISkinsTool, SkinsContainer.__implements__,
                       ActionProviderBase.__implements__)
 
     id = 'portal_skins'

Modified: CMF/trunk/CMFCore/TypesTool.py
===================================================================
--- CMF/trunk/CMFCore/TypesTool.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFCore/TypesTool.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -30,13 +30,17 @@
 from Products.PageTemplates.PageTemplateFile import PageTemplateFile
 from zLOG import LOG, ERROR
 from zope.i18nmessageid import MessageID
+from zope.interface import implements
 
 from ActionProviderBase import ActionProviderBase
 from exceptions import AccessControl_Unauthorized
 from exceptions import BadRequest
 from exceptions import zExceptions_Unauthorized
-from interfaces.portal_types import ContentTypeInformation as ITypeInformation
-from interfaces.portal_types import portal_types as ITypesTool
+from interfaces import ITypeInformation
+from interfaces import ITypesTool
+from interfaces.portal_types \
+        import ContentTypeInformation as z2ITypeInformation
+from interfaces.portal_types import portal_types as z2ITypesTool
 from permissions import AccessContentsInformation
 from permissions import ManagePortal
 from permissions import View
@@ -54,6 +58,7 @@
 
 
 class TypeInformation(SimpleItemWithProperties, ActionProviderBase):
+
     """
     Base class for information about a content type.
     """
@@ -444,11 +449,13 @@
 
 
 class FactoryTypeInformation(TypeInformation):
+
     """
     Portal content factory.
     """
 
-    __implements__ = ITypeInformation
+    implements(ITypeInformation)
+    __implements__ = z2ITypeInformation
 
     meta_type = 'Factory-based Type Information'
     security = ClassSecurityInfo()
@@ -560,11 +567,13 @@
 
 
 class ScriptableTypeInformation( TypeInformation ):
+
     """
     Invokes a script rather than a factory to create the content.
     """
 
-    __implements__ = ITypeInformation
+    implements(ITypeInformation)
+    __implements__ = z2ITypeInformation
 
     meta_type = 'Scriptable Type Information'
     security = ClassSecurityInfo()
@@ -638,15 +647,17 @@
 
 class TypesTool(UniqueObject, IFAwareObjectManager, Folder,
                 ActionProviderBase):
+
     """
         Provides a configurable registry of portal content types.
     """
 
-    __implements__ = (ITypesTool, ActionProviderBase.__implements__)
+    implements(ITypesTool)
+    __implements__ = (z2ITypesTool, ActionProviderBase.__implements__)
 
     id = 'portal_types'
     meta_type = 'CMF Types Tool'
-    _product_interfaces = (ITypeInformation,)
+    _product_interfaces = (z2ITypeInformation,)
 
     security = ClassSecurityInfo()
 

Modified: CMF/trunk/CMFCore/URLTool.py
===================================================================
--- CMF/trunk/CMFCore/URLTool.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFCore/URLTool.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -21,9 +21,11 @@
 from Globals import DTMLFile
 from Globals import InitializeClass
 from OFS.SimpleItem import SimpleItem
+from zope.interface import implements
 
 from ActionProviderBase import ActionProviderBase
-from interfaces.portal_url import portal_url as IURLTool
+from interfaces import IURLTool
+from interfaces.portal_url import portal_url as z2IURLTool
 from permissions import ManagePortal
 from permissions import View
 from utils import _dtmldir
@@ -35,7 +37,8 @@
     """ CMF URL Tool.
     """
 
-    __implements__ = (IURLTool, ActionProviderBase.__implements__)
+    implements(IURLTool)
+    __implements__ = (z2IURLTool, ActionProviderBase.__implements__)
 
     id = 'portal_url'
     meta_type = 'CMF URL Tool'

Modified: CMF/trunk/CMFCore/UndoTool.py
===================================================================
--- CMF/trunk/CMFCore/UndoTool.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFCore/UndoTool.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -19,10 +19,12 @@
 from Globals import DTMLFile
 from Globals import InitializeClass
 from OFS.SimpleItem import SimpleItem
+from zope.interface import implements
 
 from ActionProviderBase import ActionProviderBase
 from exceptions import AccessControl_Unauthorized
-from interfaces.portal_undo import portal_undo as IUndoTool
+from interfaces import IUndoTool
+from interfaces.portal_undo import portal_undo as z2IUndoTool
 from permissions import ListUndoableChanges
 from permissions import ManagePortal
 from utils import _checkPermission
@@ -36,7 +38,8 @@
     """ This tool is used to undo changes.
     """
 
-    __implements__ = (IUndoTool, ActionProviderBase.__implements__)
+    implements(IUndoTool)
+    __implements__ = (z2IUndoTool, ActionProviderBase.__implements__)
 
     id = 'portal_undo'
     meta_type = 'CMF Undo Tool'

Modified: CMF/trunk/CMFCore/WorkflowTool.py
===================================================================
--- CMF/trunk/CMFCore/WorkflowTool.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFCore/WorkflowTool.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -24,9 +24,11 @@
 from Globals import InitializeClass
 from Globals import PersistentMapping
 from OFS.Folder import Folder
+from zope.interface import implements
 
 from ActionProviderBase import ActionProviderBase
-from interfaces.portal_workflow import portal_workflow as IWorkflowTool
+from interfaces import IWorkflowTool
+from interfaces.portal_workflow import portal_workflow as z2IWorkflowTool
 from permissions import ManagePortal
 from utils import _dtmldir
 from utils import getToolByName
@@ -60,12 +62,15 @@
 
 
 class WorkflowTool(UniqueObject, Folder, ActionProviderBase):
+
     """ Mediator tool, mapping workflow objects
     """
+
+    implements(IWorkflowTool)
+    __implements__ = (z2IWorkflowTool, ActionProviderBase.__implements__)
+
     id = 'portal_workflow'
     meta_type = 'CMF Workflow Tool'
-    __implements__ = (IWorkflowTool,
-                      ActionProviderBase.__implements__)
 
     _chains_by_type = None  # PersistentMapping
     _default_chain = ('default_workflow',)

Deleted: CMF/trunk/CMFCore/bridge.zcml
===================================================================
--- CMF/trunk/CMFCore/bridge.zcml	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFCore/bridge.zcml	2005-09-24 15:24:32 UTC (rev 38590)
@@ -1,233 +0,0 @@
-<configure
-    xmlns="http://namespaces.zope.org/five"
-    >
-
-  <bridge
-      zope2=".interfaces.CachingPolicyManager.CachingPolicyManager"
-      package=".interfaces"
-      name="ICachingPolicyManager"
-      />
-
-  <bridge
-      zope2=".interfaces.Contentish.Contentish"
-      package=".interfaces"
-      name="IContentish"
-      />
-
-  <bridge
-      zope2=".interfaces.ContentTypeRegistry.ContentTypeRegistryPredicate"
-      package=".interfaces"
-      name="IContentTypeRegistryPredicate"
-      />
-
-  <bridge
-      zope2=".interfaces.ContentTypeRegistry.ContentTypeRegistry"
-      package=".interfaces"
-      name="IContentTypeRegistry"
-      />
-
-  <bridge
-      zope2=".interfaces.Discussions.Discussable"
-      package=".interfaces"
-      name="IDiscussable"
-      />
-
-  <bridge
-      zope2=".interfaces.Discussions.OldDiscussable"
-      package=".interfaces"
-      name="IOldstyleDiscussable"
-      />
-
-  <bridge
-      zope2=".interfaces.Discussions.DiscussionResponse"
-      package=".interfaces"
-      name="IDiscussionResponse"
-      />
-
-  <bridge
-      zope2=".interfaces.DublinCore.DublinCore"
-      package=".interfaces"
-      name="IDublinCore"
-      />
-
-  <bridge
-      zope2=".interfaces.DublinCore.CatalogableDublinCore"
-      package=".interfaces"
-      name="ICatalogableDublinCore"
-      />
-
-  <bridge
-      zope2=".interfaces.DublinCore.MutableDublinCore"
-      package=".interfaces"
-      name="IMutableDublinCore"
-      />
-
-  <bridge
-      zope2=".interfaces.Dynamic.DynamicType"
-      package=".interfaces"
-      name="IDynamicType"
-      />
-
-  <bridge
-      zope2=".interfaces.Folderish.Folderish"
-      package=".interfaces"
-      name="IFolderish"
-      />
-
-  <bridge
-      zope2=".interfaces.IOpaqueItems.ICallableOpaqueItem"
-      package=".interfaces"
-      name="ICallableOpaqueItem"
-      />
-
-  <bridge
-      zope2=".interfaces.IOpaqueItems.ICallableOpaqueItemEvents"
-      package=".interfaces"
-      name="ICallableOpaqueItemEvents"
-      />
-
-  <bridge
-      zope2=".interfaces.portal_actions.portal_actions"
-      package=".interfaces"
-      name="IActionsTool"
-      />
-
-  <bridge
-      zope2=".interfaces.portal_actions.ActionProvider"
-      package=".interfaces"
-      name="IActionProvider"
-      />
-
-  <bridge
-      zope2=".interfaces.portal_actions.ActionCategory"
-      package=".interfaces"
-      name="IActionCategory"
-      />
-
-  <bridge
-      zope2=".interfaces.portal_actions.Action"
-      package=".interfaces"
-      name="IAction"
-      />
-
-  <bridge
-      zope2=".interfaces.portal_actions.ActionInfo"
-      package=".interfaces"
-      name="IActionInfo"
-      />
-
-  <bridge
-      zope2=".interfaces.portal_catalog.portal_catalog"
-      package=".interfaces"
-      name="ICatalogTool"
-      />
-
-  <bridge
-      zope2=".interfaces.portal_catalog.IndexableObjectWrapper"
-      package=".interfaces"
-      name="IIndexableObjectWrapper"
-      />
-
-  <bridge
-      zope2=".interfaces.portal_discussion.oldstyle_portal_discussion"
-      package=".interfaces"
-      name="IOldstyleDiscussionTool"
-      />
-
-  <bridge
-      zope2=".interfaces.portal_discussion.portal_discussion"
-      package=".interfaces"
-      name="IDiscussionTool"
-      />
-
-  <bridge
-      zope2=".interfaces.portal_memberdata.portal_memberdata"
-      package=".interfaces"
-      name="IMemberDataTool"
-      />
-
-  <bridge
-      zope2=".interfaces.portal_memberdata.MemberData"
-      package=".interfaces"
-      name="IMemberData"
-      />
-
-  <bridge
-      zope2=".interfaces.portal_membership.portal_membership"
-      package=".interfaces"
-      name="IMembershipTool"
-      />
-
-  <bridge
-      zope2=".interfaces.portal_metadata.portal_metadata"
-      package=".interfaces"
-      name="IMetadataTool"
-      />
-
-  <bridge
-      zope2=".interfaces.portal_properties.portal_properties"
-      package=".interfaces"
-      name="IPropertiesTool"
-      />
-
-  <bridge
-      zope2=".interfaces.portal_registration.portal_registration"
-      package=".interfaces"
-      name="IRegistrationTool"
-      />
-
-  <bridge
-      zope2=".interfaces.portal_skins.SkinsContainer"
-      package=".interfaces"
-      name="ISkinsContainer"
-      />
-
-  <bridge
-      zope2=".interfaces.portal_skins.portal_skins"
-      package=".interfaces"
-      name="ISkinsTool"
-      />
-
-  <bridge
-      zope2=".interfaces.portal_types.ContentTypeInformation"
-      package=".interfaces"
-      name="ITypeInformation"
-      />
-
-  <bridge
-      zope2=".interfaces.portal_types.portal_types"
-      package=".interfaces"
-      name="ITypesTool"
-      />
-
-  <bridge
-      zope2=".interfaces.portal_undo.portal_undo"
-      package=".interfaces"
-      name="IUndoTool"
-      />
-
-  <bridge
-      zope2=".interfaces.portal_url.portal_url"
-      package=".interfaces"
-      name="IURLTool"
-      />
-
-  <bridge
-      zope2=".interfaces.portal_workflow.portal_workflow"
-      package=".interfaces"
-      name="IWorkflowTool"
-      />
-
-  <bridge
-      zope2=".interfaces.portal_workflow.WorkflowDefinition"
-      package=".interfaces"
-      name="IWorkflowDefinition"
-      />
-
-  <bridge
-      zope2=".interfaces.Syndicatable.Syndicatable"
-      package=".interfaces"
-      name="ISyndicatable"
-      />
-
-</configure>

Deleted: CMF/trunk/CMFCore/configure.zcml
===================================================================
--- CMF/trunk/CMFCore/configure.zcml	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFCore/configure.zcml	2005-09-24 15:24:32 UTC (rev 38590)
@@ -1,9 +0,0 @@
-<configure
-    xmlns="http://namespaces.zope.org/zope"
-    >
-
-  <include file="bridge.zcml"/>
-
-  <include file="implements.zcml"/>
-
-</configure>

Deleted: CMF/trunk/CMFCore/implements.zcml
===================================================================
--- CMF/trunk/CMFCore/implements.zcml	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFCore/implements.zcml	2005-09-24 15:24:32 UTC (rev 38590)
@@ -1,198 +0,0 @@
-<configure
-    xmlns="http://namespaces.zope.org/five"
-    >
-
-  <!-- ActionInformation -->
-
-  <implements
-      class=".ActionInformation.ActionCategory"
-      interface=".interfaces.IActionCategory"
-      />
-
-  <implements
-      class=".ActionInformation.Action"
-      interface=".interfaces.IAction"
-      />
-
-  <implements
-      class=".ActionInformation.ActionInfo"
-      interface=".interfaces.IActionInfo"
-      />
-
-  <implements
-      class=".ActionInformation.ActionInformation"
-      interface=".interfaces.IAction"
-      />
-
-  <!-- ActionProviderBase -->
-
-  <implements
-      class=".ActionProviderBase.ActionProviderBase"
-      interface=".interfaces.IActionProvider"
-      />
-
-  <!-- ActionsTool -->
-
-  <implements
-      class=".ActionsTool.ActionsTool"
-      interface=".interfaces.IActionsTool"
-      />
-
-  <!-- CachingPolicyManager -->
-
-  <implements
-      class=".CachingPolicyManager.CachingPolicyManager"
-      interface=".interfaces.ICachingPolicyManager"
-      />
-
-  <!-- CatalogTool -->
-
-  <implements
-      class=".CatalogTool.IndexableObjectWrapper"
-      interface=".interfaces.IIndexableObjectWrapper"
-      />
-
-  <implements
-      class=".CatalogTool.CatalogTool"
-      interface=".interfaces.ICatalogTool"
-      />
-
-  <!-- ContentTypeRegistry -->
-
-  <implements
-      class=".ContentTypeRegistry.MajorMinorPredicate"
-      interface=".interfaces.IContentTypeRegistryPredicate"
-      />
-
-  <implements
-      class=".ContentTypeRegistry.ExtensionPredicate"
-      interface=".interfaces.IContentTypeRegistryPredicate"
-      />
-
-  <implements
-      class=".ContentTypeRegistry.MimeTypeRegexPredicate"
-      interface=".interfaces.IContentTypeRegistryPredicate"
-      />
-
-  <implements
-      class=".ContentTypeRegistry.NameRegexPredicate"
-      interface=".interfaces.IContentTypeRegistryPredicate"
-      />
-
-  <implements
-      class=".ContentTypeRegistry.ContentTypeRegistry"
-      interface=".interfaces.IContentTypeRegistry"
-      />
-
-  <!-- DiscussionTool -->
-
-  <implements
-      class=".DiscussionTool.OldDiscussable"
-      interface=".interfaces.IOldstyleDiscussable"
-      />
-
-  <implements
-      class=".DiscussionTool.DiscussionTool"
-      interface=".interfaces.IOldstyleDiscussionTool"
-      />
-
-  <!-- DynamicType -->
-
-  <implements
-      class=".DynamicType.DynamicType"
-      interface=".interfaces.IDynamicType"
-      />
-
-  <!-- MemberDataTool -->
-
-  <implements
-      class=".MemberDataTool.MemberDataTool"
-      interface=".interfaces.IMemberDataTool"
-      />
-
-  <implements
-      class=".MemberDataTool.MemberData"
-      interface=".interfaces.IMemberData"
-      />
-
-  <!-- MembershipTool -->
-
-  <implements
-      class=".MembershipTool.MembershipTool"
-      interface=".interfaces.IMembershipTool"
-      />
-
-  <!-- PortalContent -->
-
-  <implements
-      class=".PortalContent.PortalContent"
-      interface=".interfaces.IContentish"
-      />
-
-  <!-- PortalFolder -->
-
-  <implements
-      class=".PortalFolder.PortalFolder"
-      interface=".interfaces.IFolderish"
-      />
-
-  <!-- RegistrationTool -->
-
-  <implements
-      class=".RegistrationTool.RegistrationTool"
-      interface=".interfaces.IRegistrationTool"
-      />
-
-  <!-- SkinsContainer -->
-
-  <implements
-      class=".SkinsContainer.SkinsContainer"
-      interface=".interfaces.ISkinsContainer"
-      />
-
-  <!-- SkinsTool -->
-
-  <implements
-      class=".SkinsTool.SkinsTool"
-      interface=".interfaces.ISkinsTool"
-      />
-
-  <!-- TypesTool -->
-
-  <implements
-      class=".TypesTool.FactoryTypeInformation"
-      interface=".interfaces.ITypeInformation"
-      />
-
-  <implements
-      class=".TypesTool.ScriptableTypeInformation"
-      interface=".interfaces.ITypeInformation"
-      />
-
-  <implements
-      class=".TypesTool.TypesTool"
-      interface=".interfaces.ITypesTool"
-      />
-
-  <!-- UndoTool -->
-
-  <implements
-      class=".UndoTool.UndoTool"
-      interface=".interfaces.IUndoTool"
-      />
-
-  <!-- URLTool -->
-
-  <implements
-      class=".URLTool.URLTool"
-      interface=".interfaces.IURLTool"
-      />
-
-  <!-- WorkflowTool -->
-
-  <implements
-      class=".WorkflowTool.WorkflowTool"
-      interface=".interfaces.IWorkflowTool"
-      />
-
-</configure>

Modified: CMF/trunk/CMFCore/interfaces/CachingPolicyManager.py
===================================================================
--- CMF/trunk/CMFCore/interfaces/CachingPolicyManager.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFCore/interfaces/CachingPolicyManager.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -15,21 +15,6 @@
 $Id$
 """
 
-from Interface import Attribute
-from Interface import Interface
-
-
-class CachingPolicyManager(Interface):
-    """
-        Manage HTTP cache policies for skin methods.
-    """
-    id = Attribute( 'id', 'Must be set to "caching_policy_manager"' )
-
-    def getHTTPCachingHeaders( content, view_method, keywords, time=None ):
-        """
-            Update HTTP caching headers in REQUEST based on 'content',
-            'view_method', and 'keywords'.
-
-            If 'time' is supplied, use it instead of the current time
-            (for reliable testing).
-        """
+# BBB: module will be removed in CMF 2.2
+#      zope2 interfaces created on runtime:
+#      - CachingPolicyManager

Modified: CMF/trunk/CMFCore/interfaces/ContentTypeRegistry.py
===================================================================
--- CMF/trunk/CMFCore/interfaces/ContentTypeRegistry.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFCore/interfaces/ContentTypeRegistry.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -15,34 +15,7 @@
 $Id$
 """
 
-from Interface import Interface
-
-
-class ContentTypeRegistryPredicate(Interface):
-    """ Express a rule for matching a given name/typ/body.
-
-    predicateWidget -- Return a snipped of HTML suitable for editing the
-        predicate; the snippet should arrange for values to be marshalled by
-        ZPublisher as a ':record', with the ID of the predicate as the name of
-        the record.
-
-    The registry will call the predictate's 'edit' method, passing the fields
-    of the record.
-    """
-
-    def __call__(name, typ, body):
-        """ Return true if the rule matches, else false. """
-
-    def getTypeLabel():
-        """ Return a human-readable label for the predicate type. """
-
-
-class ContentTypeRegistry(Interface):
-    """ Registry for rules which map PUT args to a CMF Type Object. """
-
-    def findTypeName(name, typ, body):
-        """\
-        Perform a lookup over a collection of rules, returning the
-        the Type object corresponding to name/typ/body.  Return None
-        if no match found.
-        """
+# BBB: module will be removed in CMF 2.2
+#      zope2 interfaces created on runtime:
+#      - ContentTypeRegistryPredicate
+#      - ContentTypeRegistry

Modified: CMF/trunk/CMFCore/interfaces/Contentish.py
===================================================================
--- CMF/trunk/CMFCore/interfaces/Contentish.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFCore/interfaces/Contentish.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -15,24 +15,6 @@
 $Id$
 """
 
-from Interface import Interface
-
-
-class Contentish(Interface):
-    """
-    General interface for "contentish" items.
-
-    These methods need to be implemented by any class that wants to be a
-    first-class citizen in the Portal Content world.
-
-    PortalContent implements this interface.
-    """
-
-    def SearchableText():
-        """
-        SearchableText is called to provide the Catalog with textual
-        information about your object. It is a string usually generated
-        by concatenating the string attributes of your content class. This
-        string can then be used by the catalog to index your document and
-        make it findable through the catalog.
-        """
+# BBB: module will be removed in CMF 2.2
+#      zope2 interfaces created on runtime:
+#      - Contentish

Modified: CMF/trunk/CMFCore/interfaces/Discussions.py
===================================================================
--- CMF/trunk/CMFCore/interfaces/Discussions.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFCore/interfaces/Discussions.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -15,142 +15,8 @@
 $Id$
 """
 
-from Interface import Interface
-
-
-class Discussable(Interface):
-    """ Discussable is the interface for things which can have responses.
-    """
-
-    def createReply(title, text, Creator=None):
-        """
-        Create a reply in the proper place.
-
-        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(title, text, REQUEST, RESPONSE):
-        """
-        Create a reply in the proper place.
-
-        Permission: Reply to item
-        Returns: HTML (directly or via redirect)
-        """
-
-    def getReplyLocationAndID(REQUEST):
-        """
-        This method determines where a user's reply should be stored, and
-        what it's ID should be.
-
-        You don't really want to force users to have to select a
-        unique ID each time they want to reply to something.  The
-        present implementation selects a folder in the Member's home
-        folder called 'Correspondence' (creating it if it is missing)
-        and finds a free ID in that folder.
-
-        createReply should use this method to determine what the reply
-        it creates should be called, and where it should be placed.
-
-        This method (and createReply, I expect) do not really belong in
-        this interface.  There should be a DiscussionManager singleton
-        (probably the portal object itself) which handles this.
-
-        Permissions: None assigned
-        Returns: 2-tuple, containing the container object, and a string ID.
-        """
-
-    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
-        """
-
-    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.
-        """
-
-
-class DiscussionResponse(Interface):
-    """ This interface describes the behaviour of a Discussion Response.
-    """
-
-    def inReplyTo(REQUEST=None):
-        """
-        Return the Discussable object which this item is associated with
-
-        Permissions: None assigned
-        Returns: a Discussable object
-        """
-
-    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
-        support or accept replies, a ValueError will be raised.  (This
-        does not seem like the right exception.)
-
-        Permissions: None assigned
-        Returns: None
-        """
-
-    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
-        oldest to newest.
-
-        If 'size' is not zero, only the closest 'size' parents will be
-        returned.
-        """
+# BBB: module will be removed in CMF 2.2
+#      zope2 interfaces created on runtime:
+#      - Discussable
+#      - OldDiscussable
+#      - DiscussionResponse

Modified: CMF/trunk/CMFCore/interfaces/DublinCore.py
===================================================================
--- CMF/trunk/CMFCore/interfaces/DublinCore.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFCore/interfaces/DublinCore.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -15,279 +15,8 @@
 $Id$
 """
 
-from Interface import Interface
-
-
-class DublinCore(Interface):
-    """ Dublin Core metadata elements supported by CMF and their semantics.
-    """
-
-    def Title():
-        """ Dublin Core Title element - resource name.
-
-        Permission -- View
-
-        Returns -- String
-        """
-
-    def listCreators():
-        """ List Dublin Core Creator elements - resource authors.
-
-        Depending on the implementation, this returns the full name(s) of the
-        author(s) of the content object or their ids.
-
-        Permission -- View
-
-        Returns -- Sequence of strings
-        """
-
-    def Creator():
-        """ Dublin Core Creator element - resource author.
-
-        The first Dublin Core Creator element or an empty string.
-
-        Permission -- View
-
-        Returns -- String
-        """
-
-    def Subject():
-        """ Dublin Core Subject element - resource keywords.
-
-        Return zero or more keywords associated with the content object.
-
-        Permission -- View
-
-        Returns -- Sequence of strings
-        """
-
-    def Description():
-        """ Dublin Core Description element - resource summary.
-
-        Return a natural language description of this object.
-
-        Permission -- View
-
-        Returns -- String
-        """
-
-    def Publisher():
-        """ Dublin Core Publisher element - resource publisher.
-
-        Return full formal name of the entity or person responsible for
-        publishing the resource.
-
-        Permission -- View
-
-        Returns -- String
-        """
-
-    def listContributors():
-        """ Dublin Core Contributor elements - resource collaborators.
-
-        Return zero or additional collaborators.
-
-        Permission -- View
-
-        Returns -- Sequence of strings
-        """
-
-    def Contributors():
-        """ Deprecated alias of listContributors.
-
-        'initial caps' names are reserved for strings.
-        """
-
-    def Date():
-        """ Dublin Core Date element - default date.
-
-        Permission -- View
-
-        Returns -- String, formatted 'YYYY-MM-DD H24:MN:SS TZ'
-        """
-
-    def CreationDate():
-        """ Dublin Core Date element - date resource created.
-
-        Permission -- View
-
-        Returns -- String, formatted 'YYYY-MM-DD H24:MN:SS TZ'
-        """
-
-    def EffectiveDate():
-        """ Dublin Core Date element - date resource becomes effective.
-
-        Permission -- View
-
-        Returns -- String, formatted 'YYYY-MM-DD H24:MN:SS TZ'
-        """
-
-    def ExpirationDate():
-        """ Dublin Core Date element - date resource expires.
-
-        Permission -- View
-
-        Returns -- String, formatted 'YYYY-MM-DD H24:MN:SS TZ'
-        """
-
-    def ModificationDate():
-        """ Dublin Core Date element - date resource last modified.
-
-        Permission -- View
-
-        Returns -- String, formatted 'YYYY-MM-DD H24:MN:SS TZ'
-        """
-
-    def Type():
-        """ Dublin Core Type element - resource type.
-
-        Return a human-readable type name for the resource (perhaps mapped
-        from its Zope meta_type).
-
-        Permission -- View
-
-        Returns -- String
-        """
-
-    def Format():
-        """ Dublin Core Format element - resource format.
-
-        Return the resource's MIME type (e.g. 'text/html', 'image/png', etc.).
-
-        Permission -- View
-
-        Returns -- String
-        """
-
-    def Identifier():
-        """ Dublin Core Identifier element - resource ID.
-
-        Returns unique ID (a URL) for the resource.
-
-        Permission -- View
-
-        Returns -- String
-        """
-
-    def Language():
-        """ Dublin Core Language element - resource language.
-
-        Return the RFC language code (e.g. 'en-US', 'pt-BR') for the resource.
-
-        Permission -- View
-
-        Returns -- String
-        """
-
-    def Rights():
-        """ Dublin Core Rights element - resource copyright.
-
-        Return a string describing the intellectual property status, if any,
-        of the resource.
-
-        Permission -- View
-
-        Returns -- String
-        """
-
-
-class CatalogableDublinCore(Interface):
-    """ Provide Zope-internal date objects for cataloging purposes.
-    """
-
-    def created():
-        """ Dublin Core Date element - date resource created.
-
-        Permission -- View
-
-        Returns -- DateTime
-        """
-
-    def effective():
-        """ Dublin Core Date element - date resource becomes effective.
-
-        Permission -- View
-
-        Returns -- DateTime
-        """
-
-    def expires():
-        """ Dublin Core Date element - date resource expires.
-
-        Permission -- View
-
-        Returns -- DateTime
-        """
-
-    def modified():
-        """ Dublin Core Date element - date resource last modified.
-
-        Permission -- View
-
-        Returns -- DateTime
-        """
-
-
-class MutableDublinCore(Interface):
-    """ Update interface for mutable metadata.
-    """
-
-    def setTitle(title):
-        """ Set Dublin Core Title element - resource name.
-
-        Permission -- Modify portal content
-        """
-
-    def setCreators(creators):
-        """ Set Dublin Core Creator elements - resource authors.
-
-        Permission -- Modify portal content
-        """
-
-    def setSubject(subject):
-        """ Set Dublin Core Subject element - resource keywords.
-
-        Permission -- Modify portal content
-        """
-
-    def setDescription(description):
-        """ Set Dublin Core Description element - resource summary.
-
-        Permission -- Modify portal content
-        """
-
-    def setContributors(contributors):
-        """ Set Dublin Core Contributor elements - resource collaborators.
-
-        Permission -- Modify portal content
-        """
-
-    def setEffectiveDate(effective_date):
-        """ Set Dublin Core Date element - date resource becomes effective.
-
-        Permission -- Modify portal content
-        """
-
-    def setExpirationDate(expiration_date):
-        """ Set Dublin Core Date element - date resource expires.
-
-        Permission -- Modify portal content
-        """
-
-    def setFormat(format):
-        """ Set Dublin Core Format element - resource format.
-
-        Permission -- Modify portal content
-        """
-
-    def setLanguage(language):
-        """ Set Dublin Core Language element - resource language.
-
-        Permission -- Modify portal content
-        """
-
-    def setRights(rights):
-        """ Set Dublin Core Rights element - resource copyright.
-
-        Permission -- Modify portal content
-        """
+# BBB: module will be removed in CMF 2.2
+#      zope2 interfaces created on runtime:
+#      - DublinCore
+#      - CatalogableDublinCore
+#      - MutableDublinCore

Modified: CMF/trunk/CMFCore/interfaces/Dynamic.py
===================================================================
--- CMF/trunk/CMFCore/interfaces/Dynamic.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFCore/interfaces/Dynamic.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -15,50 +15,6 @@
 $Id$
 """
 
-from Interface import Interface
-
-
-class DynamicType(Interface):
-    """ General interface for dynamic items.
-    """
-
-    def getPortalTypeName():
-        """ Get the portal type name that can be passed to portal_types.
-
-        If the object is uninitialized, returns None.
-
-        Permission -- Always available
-        """
-
-    def getTypeInfo():
-        """ Get the TypeInformation object specified by the portal type.
-
-        A shortcut to 'getTypeInfo' of portal_types.
-
-        Permission -- Always available
-        """
-
-    def getActionInfo(action_chain, check_visibility=0, check_condition=0):
-        """ Get an Action info mapping specified by a chain of actions.
-
-        A shortcut to 'getActionInfo' of the related TypeInformation object.
-
-        Permission -- Always available
-        """
-
-    def getIcon(relative_to_portal=0):
-        """ Get the path to an object's icon.
-
-        This method is used in the folder_contents view to generate an
-        appropriate icon for the items found in the folder.
-
-        If the content item does not define an attribute named "icon"
-        this method will return the path "/misc_/dtmldoc.gif", which is
-        the icon used for DTML Documents.
-
-        If 'relative_to_portal' is true, return only the portion of
-        the icon's URL which finds it "within" the portal;  otherwise,
-        return it as an absolute URL.
-
-        Permission -- Always available
-        """
+# BBB: module will be removed in CMF 2.2
+#      zope2 interfaces created on runtime:
+#      - DynamicType

Modified: CMF/trunk/CMFCore/interfaces/Folderish.py
===================================================================
--- CMF/trunk/CMFCore/interfaces/Folderish.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFCore/interfaces/Folderish.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -15,53 +15,6 @@
 $Id$
 """
 
-from Interface import Interface
-
-
-class Folderish(Interface):
-    """ General interface for "folderish" items.
-    """
-
-    def contentItems(filter=None):
-        """ List contentish and folderish sub-objects and their IDs.
-
-        Provide a filtered view onto 'objectItems', allowing only
-        PortalFolders and PortalContent-derivatives to show through.
-
-        Permission -- Always available (not publishable)
-
-        Returns -- List of (object ID, object) tuples
-        """
-
-    def contentIds(filter=None):
-        """ List IDs of contentish and folderish sub-objects.
-
-        Provide a filtered view onto 'objectIds', allowing only PortalFolders
-        and PortalContent-derivatives to show through.
-
-        Permission -- Always available (not publishable)
-
-        Returns -- List of object IDs
-        """
-
-    def contentValues(filter=None):
-        """ List contentish and folderish sub-objects.
-
-        Provide a filtered view onto 'objectValues', allowing only
-        PortalFolders and PortalContent-derivatives to show through.
-
-        Permission -- Always available (not publishable)
-
-        Returns -- List of objects
-        """
-
-    def listFolderContents(contentFilter=None):
-        """ List viewable contentish and folderish sub-objects.
-
-        Hook around 'contentValues' to let 'folder_contents' be protected.
-        Duplicating skip_unauthorized behavior of dtml-in.
-
-        Permission -- List folder contents
-
-        Returns -- List of objects
-        """
+# BBB: module will be removed in CMF 2.2
+#      zope2 interfaces created on runtime:
+#      - Folderish

Modified: CMF/trunk/CMFCore/interfaces/IOpaqueItems.py
===================================================================
--- CMF/trunk/CMFCore/interfaces/IOpaqueItems.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFCore/interfaces/IOpaqueItems.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -15,46 +15,7 @@
 $Id$
 """
 
-from Interface import Interface
-
-
-class ICallableOpaqueItem(Interface):
-
-    """Interface for callable opaque items.
-
-    Opaque items are subelements that are contained using something that
-    is not an ObjectManager.
-
-    On add, copy, move and delete operations a marked opaque items
-    'manage_afterAdd', 'manage_afterClone' and 'manage_beforeDelete' hooks
-    get called if available. Unavailable hooks do not throw exceptions.
-    """
-
-    def __init__(obj, id):
-        """Return the opaque item and assign it to 'obj' as attr with 'id'.
-        """
-
-    def __call__():
-        """Return the opaque items value.
-        """
-
-    def getId():
-        """Return the id of the opaque item.
-        """
-
-class ICallableOpaqueItemEvents(Interface):
-
-    """CMF specific events upon copying, renaming and deletion.
-    """
-
-    def manage_afterClone(item):
-        """After clone event hook.
-        """
-
-    def manage_beforeDelete(item, container):
-        """Before delete event hook.
-        """
-
-    def manage_afterAdd(item, container):
-        """After add event hook.
-        """
+# BBB: module will be removed in CMF 2.2
+#      zope2 interfaces created on runtime:
+#      - ICallableOpaqueItem
+#      - ICallableOpaqueItemEvents

Modified: CMF/trunk/CMFCore/interfaces/Syndicatable.py
===================================================================
--- CMF/trunk/CMFCore/interfaces/Syndicatable.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFCore/interfaces/Syndicatable.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -15,19 +15,6 @@
 $Id$
 """
 
-from Interface import Interface
-
-
-class Syndicatable(Interface):
-    """\
-    Returns back a list of objects which implements the DublinCore.
-    """
-
-    def synContentValues(self):
-        """
-        Returns a list of results which is to be Syndicated.  For example, the normal call
-        contentValues (on PortalFolders) returns a list of subObjects of the current object
-        (i.e. objectValues with filtering applied).  For the case of a Topic, one would
-        return a sequence of objects from a catalog query, not the subObjects of the Topic.
-        What is returned must implement the DublinCore.
-        """
+# BBB: module will be removed in CMF 2.2
+#      zope2 interfaces created on runtime:
+#      - Syndicatable

Modified: CMF/trunk/CMFCore/interfaces/__init__.py
===================================================================
--- CMF/trunk/CMFCore/interfaces/__init__.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFCore/interfaces/__init__.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -1 +1,93 @@
-""" CMFCore.interfaces package """
+##############################################################################
+#
+# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+""" CMFCore.interfaces package.
+
+$Id$
+"""
+
+from _content import *
+from _tools import *
+
+# BBB: will be removed in CMF 2.2
+#      create zope2 interfaces
+from Interface.bridge import createZope3Bridge
+import CachingPolicyManager
+import Contentish
+import ContentTypeRegistry
+import Discussions
+import DublinCore
+import Dynamic
+import Folderish
+import IOpaqueItems
+import portal_actions
+import portal_catalog
+import portal_discussion
+import portal_memberdata
+import portal_membership
+import portal_metadata
+import portal_properties
+import portal_registration
+import portal_skins
+import portal_types
+import portal_undo
+import portal_url
+import portal_workflow
+import Syndicatable
+
+createZope3Bridge(ICachingPolicyManager, CachingPolicyManager,
+                  'CachingPolicyManager')
+createZope3Bridge(IContentish, Contentish, 'Contentish')
+createZope3Bridge(IContentTypeRegistryPredicate, ContentTypeRegistry,
+                  'ContentTypeRegistryPredicate')
+createZope3Bridge(IContentTypeRegistry, ContentTypeRegistry,
+                  'ContentTypeRegistry')
+createZope3Bridge(IDiscussable, Discussions, 'Discussable')
+createZope3Bridge(IOldstyleDiscussable, Discussions, 'OldDiscussable')
+createZope3Bridge(IDiscussionResponse, Discussions, 'DiscussionResponse')
+createZope3Bridge(IDublinCore, DublinCore, 'DublinCore')
+createZope3Bridge(ICatalogableDublinCore, DublinCore, 'CatalogableDublinCore')
+createZope3Bridge(IMutableDublinCore, DublinCore, 'MutableDublinCore')
+createZope3Bridge(IDynamicType, Dynamic, 'DynamicType')
+createZope3Bridge(IFolderish, Folderish, 'Folderish')
+createZope3Bridge(ICallableOpaqueItem, IOpaqueItems, 'ICallableOpaqueItem')
+createZope3Bridge(ICallableOpaqueItemEvents, IOpaqueItems,
+                  'ICallableOpaqueItemEvents')
+createZope3Bridge(IActionsTool, portal_actions, 'portal_actions')
+createZope3Bridge(IActionProvider, portal_actions, 'ActionProvider')
+createZope3Bridge(IActionCategory, portal_actions, 'ActionCategory')
+createZope3Bridge(IAction, portal_actions, 'Action')
+createZope3Bridge(IActionInfo, portal_actions, 'ActionInfo')
+createZope3Bridge(ICatalogTool, portal_catalog, 'portal_catalog')
+createZope3Bridge(IIndexableObjectWrapper, portal_catalog,
+                  'IndexableObjectWrapper')
+createZope3Bridge(IOldstyleDiscussionTool, portal_discussion,
+                  'oldstyle_portal_discussion')
+createZope3Bridge(IDiscussionTool, portal_discussion, 'portal_discussion')
+createZope3Bridge(IMemberDataTool, portal_memberdata, 'portal_memberdata')
+createZope3Bridge(IMemberData, portal_memberdata, 'MemberData')
+createZope3Bridge(IMembershipTool, portal_membership, 'portal_membership')
+createZope3Bridge(IMetadataTool, portal_metadata, 'portal_metadata')
+createZope3Bridge(IPropertiesTool, portal_properties, 'portal_properties')
+createZope3Bridge(IRegistrationTool, portal_registration,
+                  'portal_registration')
+createZope3Bridge(ISkinsContainer, portal_skins, 'SkinsContainer')
+createZope3Bridge(ISkinsTool, portal_skins, 'portal_skins')
+createZope3Bridge(ITypeInformation, portal_types, 'ContentTypeInformation')
+createZope3Bridge(ITypesTool, portal_types, 'portal_types')
+createZope3Bridge(IUndoTool, portal_undo, 'portal_undo')
+createZope3Bridge(IURLTool, portal_url, 'portal_url')
+createZope3Bridge(IWorkflowTool, portal_workflow, 'portal_workflow')
+createZope3Bridge(IWorkflowDefinition, portal_workflow, 'WorkflowDefinition')
+createZope3Bridge(ISyndicatable, Syndicatable, 'Syndicatable')
+
+del createZope3Bridge

Copied: CMF/trunk/CMFCore/interfaces/_content.py (from rev 38589, CMF/branches/goldegg-phase-1/CMFCore/interfaces/_content.py)

Copied: CMF/trunk/CMFCore/interfaces/_tools.py (from rev 38589, CMF/branches/goldegg-phase-1/CMFCore/interfaces/_tools.py)

Modified: CMF/trunk/CMFCore/interfaces/portal_actions.py
===================================================================
--- CMF/trunk/CMFCore/interfaces/portal_actions.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFCore/interfaces/portal_actions.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -15,164 +15,10 @@
 $Id$
 """
 
-from Interface import Attribute
-from Interface import Interface
-
-
-class portal_actions(Interface):
-    """ Gathers a list of links which the user is allowed to view according to
-    the current context.
-    """
-    id = Attribute('id', 'Must be set to "portal_actions"')
-
-    def listActionProviders():
-        """ List the ids of all Action Providers queried by this tool.
-
-        Permission -- Manage portal
-
-        Returns -- Tuple of Action Provider ids
-        """
-
-    def addActionProvider(provider_name):
-        """ Add an Action Provider id to the providers queried by this tool.
-
-        A provider must implement the ActionProvider Interface.
-        OldstyleActionProviders are currently also supported.
-
-        The provider is only added if the actions tool can find the object
-        corresponding to the provider_name.
-
-        Permission -- Manage portal
-        """
-
-    def deleteActionProvider(provider_name):
-        """ Delete an Action Provider id from providers queried by this tool.
-
-        The deletion only takes place if provider_name is actually found among
-        the known action providers.
-
-        Permission -- Manage portal
-        """
-
-    def listFilteredActionsFor(object=None):
-        """ List all actions available to the user.
-
-        See the ActionInfo interface for provided keys. 'visible', 'available'
-        and 'allowed' are always True in actions returned by this method.
-
-        Permission -- Always available
-
-        Returns -- Dictionary of category / ActionInfo list pairs
-        """
-
-
-class ActionProvider(Interface):
-    """ The interface expected of an object that can provide actions.
-    """
-
-    def listActions(info=None, object=None):
-        """ List all the actions defined by a provider.
-
-        If 'object' is specified, object specific actions are included.
-
-        The 'info' argument is deprecated and may be removed in a future
-        version. If 'object' isn't specified, the method uses for backwards
-        compatibility 'info.content' as object.
-
-        Returns -- Tuple of ActionInformation objects (or Action mappings)
-        """
-
-    def getActionObject(action):
-        """Return the actions object or None if action doesn't exist.
-        
-        'action' is an action 'path' (e.g. 'object/view').
-        
-        Raises an ValueError exception if the action is of the wrong format.
-        
-        Permission -- Private
-
-        Returns -- The actions object reference.
-        """
-
-    def listActionInfos(action_chain=None, object=None, check_visibility=1,
-                        check_permissions=1, check_condition=1, max=-1):
-        """ List ActionInfo objects.
-
-        'action_chain' is a sequence of action 'paths' (e.g. 'object/view').
-        If specified, only these actions will be returned in the given order.
-
-        If 'object' is specified, object specific Actions are included.
-
-        If 'max' is specified, only the first max Actions are returned.
-
-        Permission -- Always available (not publishable)
-
-        Returns -- Tuple of ActionInfo objects
-        """
-
-    def getActionInfo(action_chain, object=None, check_visibility=0,
-                      check_condition=0):
-        """ Get an ActionInfo object specified by a chain of actions.
-
-        Permission -- Always available
-
-        Returns -- ActionInfo object
-        """
-
-
-class ActionCategory(Interface):
-    """ Group of Action objects.
-    """
-
-    def listActions():
-        """ List the actions defined in this category and its subcategories.
-
-        Permission -- Python only
-
-        Returns -- Tuple of Action objects.
-        """
-
-
-class Action(Interface):
-    """ Reference to an action.
-    """
-
-    def getInfoData():
-        """ Get the data needed to create an ActionInfo.
-
-        Default keys are: 'id', 'category', 'title', 'description', 'url',
-        'icon', 'available', 'permissions' and 'visible'.
-
-        Instead of computed values callable expression objects or methods are
-        returned. For performance reasons, these objects are called later and
-        only if the values are actually needed. The keys for all these lazy
-        values are registered in a separate list.
-
-        Permission -- Python only
-
-        Returns -- Lazy info mapping and list of lazy keys.
-        """
-
-
-class ActionInfo(Interface):
-    """ A lazy dictionary for Action infos.
-
-    Each ActionInfo object has the following keys:
-
-      - id (string): not unique identifier
-
-      - title (string)
-
-      - url (string): URL to access the action
-
-      - category (string): one of "user", "folder", "object", "global",
-        "workflow" or a custom category
-
-      - visible (boolean)
-
-      - available (boolean): the result of checking the condition
-
-      - allowed (boolean): the result of checking permissions;
-        The user must have at least one of the listed permissions to access
-        the action. If the list is empty, the user is allowed.
-    """
+# BBB: module will be removed in CMF 2.2
+#      zope2 interfaces created on runtime:
+#      - portal_actions
+#      - ActionProvider
+#      - ActionCategory
+#      - Action
+#      - ActionInfo

Modified: CMF/trunk/CMFCore/interfaces/portal_catalog.py
===================================================================
--- CMF/trunk/CMFCore/interfaces/portal_catalog.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFCore/interfaces/portal_catalog.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -15,60 +15,7 @@
 $Id$
 """
 
-from Interface import Attribute
-from Interface import Interface
-
-
-class portal_catalog(Interface):
-    '''This tool interacts with a customized ZCatalog.
-    '''
-    id = Attribute('id', 'Must be set to "portal_catalog"')
-
-    # searchResults inherits security assertions from ZCatalog.
-    def searchResults(REQUEST=None, **kw):
-        '''Calls ZCatalog.searchResults() with extra arguments that
-        limit the results to what the user is allowed to see.
-        '''
-
-    # __call__ inherits security assertions from ZCatalog.
-    def __call__(REQUEST=None, **kw):
-        '''Same as searchResults().'''
-
-    def unrestrictedSearchResults(REQUEST=None, **kw):
-        '''Calls ZCatalog.searchResults() without any CMF specific
-        processing.
-
-        Permission -- Python only
-        '''
-
-    def indexObject(object):
-        """ Add to catalog.
-
-        Permission -- Python only
-        """
-
-    def unindexObject(object):
-        """ Remove from catalog.
-
-        Permission -- Python only
-        """
-
-    def reindexObject(object, idxs=[], update_metadata=1):
-        """ Update entry in catalog.
-
-        The optional idxs argument is a list of specific indexes
-        to update (all of them by default).
-
-        Permission -- Python only
-        """
-
-
-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.
-        """
+# BBB: module will be removed in CMF 2.2
+#      zope2 interfaces created on runtime:
+#      - portal_catalog
+#      - IndexableObjectWrapper

Modified: CMF/trunk/CMFCore/interfaces/portal_discussion.py
===================================================================
--- CMF/trunk/CMFCore/interfaces/portal_discussion.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFCore/interfaces/portal_discussion.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -15,45 +15,7 @@
 $Id$
 """
 
-from Interface import Attribute
-from Interface import Interface
-
-
-class oldstyle_portal_discussion(Interface):
-    """ Links content to discussions.
-    """
-    id = Attribute('id', 'Must be set to "portal_discussion"')
-
-    def getDiscussionFor(content):
-        """ Get DiscussionItemContainer for content, create it if necessary.
-
-        Permission -- Always available
-
-        Returns -- DiscussionItemContainer object
-        """
-
-    def isDiscussionAllowedFor(content):
-        """ Get boolean indicating whether discussion is allowed for content.
-
-        This may be looked up via an object-specific value, or by place, or
-        from a site-wide policy.
-
-        Permission -- Always available
-
-        Returns -- Boolean value
-        """
-
-
-class portal_discussion(oldstyle_portal_discussion):
-    """ Links content to discussions.
-    """
-
-    def overrideDiscussionFor(content, allowDiscussion):
-        """ Override discussability for the given object or clear the setting.
-
-        If 'allowDiscussion' is None, then clear any overridden setting for
-        discussability, letting the site's default policy apply.  Otherwise,
-        set the override to match the boolean equivalent of 'allowDiscussion'.
-
-        Permission -- Always available
-        """
+# BBB: module will be removed in CMF 2.2
+#      zope2 interfaces created on runtime:
+#      - oldstyle_portal_discussion
+#      - portal_discussion

Modified: CMF/trunk/CMFCore/interfaces/portal_memberdata.py
===================================================================
--- CMF/trunk/CMFCore/interfaces/portal_memberdata.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFCore/interfaces/portal_memberdata.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -15,81 +15,7 @@
 $Id$
 """
 
-from Interface import Attribute
-from Interface import Interface
-
-
-class portal_memberdata(Interface):
-    '''A helper for portal_membership that transparently adds
-    member data to user objects.
-    '''
-    id = Attribute('id', 'Must be set to "portal_memberdata"')
-
-    ## wrapUser__roles__ = ()  # Private.
-    def wrapUser(u):
-        '''
-        If possible, returns the Member object that corresponds
-        to the given User object.
-        '''
-    ## getMemberDataContents__roles__ = ()  # Private.
-    def getMemberDataContents():
-        '''
-        Returns a list containing a dictionary with information
-        about the _members BTree contents: member_count is the
-        total number of member instances stored in the memberdata-
-        tool while orphan_count is the number of member instances
-        that for one reason or another are no longer in the
-        underlying acl_users user folder.
-        The result is designed to be iterated over in a dtml-in
-        '''
-
-    def pruneMemberDataContents():
-        """ Delete member data of all members not listet in acl_users.
-
-        Compare the user IDs stored in the member data tool with the list in
-        the actual underlying acl_users and delete anything not in acl_users.
-
-        Permission -- Python only
-        """
-
-    def searchMemberData(search_param, search_term, attributes=()):
-        """ Search members.
-
-        Returns a sequence of dictionaries containing data for members
-        that match the query as expressed by search_param and search_term.
-        The contents of each member data mapping can be influenced by
-        passing in a sequence of desired attributes, by default the only
-        data returned is the username and the email address.
-
-        Permission -- Python only
-
-        Returns -- Sequence of dictionaries
-        """
-
-    def registerMemberData(m, id):
-        """ Add the given member data to the _members btree.
-
-        This is done as late as possible to avoid side effect transactions and
-        to reduce the necessary number of entries.
-
-        Permission -- Python only
-        """
-
-    def deleteMemberData(member_id):
-        """ Delete member data of specified member.
-
-        Permission -- Python only
-
-        Returns -- Boolean value
-        """
-
-
-class MemberData(Interface):
-    """ MemberData interface.
-    """
-
-    def setProperties(properties=None, **kw):
-        """ Allows the authenticated member to set his/her own properties.
-
-        Permission -- Set own properties
-        """
+# BBB: module will be removed in CMF 2.2
+#      zope2 interfaces created on runtime:
+#      - portal_memberdata
+#      - MemberData

Modified: CMF/trunk/CMFCore/interfaces/portal_membership.py
===================================================================
--- CMF/trunk/CMFCore/interfaces/portal_membership.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFCore/interfaces/portal_membership.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -15,207 +15,6 @@
 $Id$
 """
 
-from Interface import Attribute
-from Interface import Interface
-
-
-class portal_membership(Interface):
-    """ Deals with the details of how and where to store and retrieve
-    members and their member folders.
-    """
-    id = Attribute('id', 'Must be set to "portal_membership"')
-
-    def setPassword(password, domains=None):
-        """ Allows the authenticated member to set his/her own password.
-
-        Permission -- Set own password
-        """
-
-    def getAuthenticatedMember():
-        """
-        Returns the currently authenticated member object
-        or the Anonymous User.
-
-        Permission -- Always available
-        """
-
-    def isAnonymousUser():
-        """
-        Returns 1 if the user is not logged in.
-
-        Permission -- Always available
-        """
-
-    def checkPermission(permissionName, object, subobjectName=None):
-        """
-        Checks whether the current user has the given permission on
-        the given object or subobject.
-
-        Permission -- Always available
-        """
-
-    def credentialsChanged(password):
-        """
-        Notifies the authentication mechanism that this user has changed
-        passwords.  This can be used to update the authentication cookie.
-        Note that this call should *not* cause any change at all to user
-        databases.
-
-        Permission -- Always available
-        """
-
-    def getMembersFolder():
-        """ Get the members folder object.
-
-        If no members folder is set or the set folder id doesn't exist, None
-        is returned.
-
-        Permission -- Always available
-
-        Returns -- Members folder object or None
-        """
-
-    def getHomeFolder(id=None, verifyPermission=0):
-        """Returns a member's home folder object or None.
-        Set verifyPermission to 1 to return None when the user
-        doesn't have the View permission on the folder.
-
-        Permission -- Always available
-        """
-
-    def getHomeUrl(id=None, verifyPermission=0):
-        """Returns the URL to a member's home folder or None.
-        Set verifyPermission to 1 to return None when the user
-        doesn't have the View permission on the folder.
-
-        Permission -- Always available
-        """
-
-    def getMemberById(id):
-        """
-        Returns the given member.
-
-        Permission -- Manage users
-        """
-
-    def listMemberIds():
-        """ Lists the ids of all members.
-
-        This may eventually be replaced with a set of methods for querying
-        pieces of the list rather than the entire list at once.
-
-        Permission -- Manage users
-        """
-
-    def listMembers():
-        """ Gets the list of all members.
-
-        Permission -- Manage users
-        """
-
-    def getCandidateLocalRoles(obj):
-        """ What local roles can I assign?
-
-        Permission -- Always available
-
-        Returns -- Tuple of roles
-        """
-
-    def setLocalRoles(obj, member_ids, member_role, reindex=1):
-        """ Add local roles on an item.
-
-        Permission -- Always available
-        """
-
-    def deleteLocalRoles(obj, member_ids, reindex=1, recursive=0):
-        """ Delete local roles of specified members.
-
-        Permission -- Always available
-        """
-
-    def addMember(id, password, roles, domains):
-        """ Adds a new member to the user folder.
-
-        Security checks will have already been performed. Called by
-        portal_registration.
-
-        Permission -- Python only
-        """
-
-    def deleteMembers(member_ids, delete_memberareas=1, delete_localroles=1):
-        """ Delete members specified by member_ids.
-
-        Delete members in acl_users and member data in portal_memberdata.
-        If delete_memberareas is true, delete members' home folders including
-        all content items. If delete_localroles is true, recursively delete
-        members' local roles, starting from the portal root.
-
-        Permission -- Manage users
-
-        Returns -- Tuple listing member_ids of deleted members
-        """
-
-    def getPortalRoles():
-        """
-        Return all local roles defined by the portal itself,
-        which means roles that are useful and understood
-        by the portal object
-
-        Permission -- Manage portal
-        """
-
-    def setRoleMapping(portal_role, userfolder_role):
-        """
-        set the mapping of roles between roles understood by
-        the portal and roles coming from outside user sources
-
-        Permission -- Manage portal
-        """
-
-    def getMappedRole(portal_role):
-        """
-        returns a role name if the portal role is mapped to
-        something else or an empty string if it is not
-
-        Permission -- Manage portal
-        """
-
-    def getMemberareaCreationFlag():
-        """
-        Returns the flag indicating whether the membership tool
-        will create a member area if an authenticated user from
-        an underlying user folder logs in first without going
-        through the join process
-
-        Permission -- Manage portal
-        """
-
-    def setMemberareaCreationFlag():
-        """
-        sets the flag indicating whether the membership tool
-        will create a member area if an authenticated user from
-        an underlying user folder logs in first without going
-        through the join process
-
-        Permission -- Manage portal
-        """
-
-    def createMemberArea(member_id=''):
-        """ Create a member area for 'member_id' or authenticated user.
-
-        Permission -- Always available
-
-        Returns -- created member folder object or None
-        """
-
-    def createMemberarea(member_id=''):
-        """ Deprecated alias of createMemberArea.
-        """
-
-    def deleteMemberArea(member_id):
-        """ Delete member area of member specified by member_id.
-
-        Permission -- Manage users
-
-        Returns -- Boolean value
-        """
+# BBB: module will be removed in CMF 2.2
+#      zope2 interfaces created on runtime:
+#      - portal_membership

Modified: CMF/trunk/CMFCore/interfaces/portal_metadata.py
===================================================================
--- CMF/trunk/CMFCore/interfaces/portal_metadata.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFCore/interfaces/portal_metadata.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -15,88 +15,6 @@
 $Id$
 """
 
-from Interface import Attribute
-from Interface import Interface
-
-
-class portal_metadata(Interface):
-    """
-        CMF metadata policies interface.
-    """
-    id = Attribute('id', 'Must be set to "portal_metadata"')
-
-    #
-    #   Site-wide queries, specific to Dublin Core metadata.
-    #
-    def getFullName(userid):
-        """ Convert an internal userid to a "formal" name.
-        
-        o Convert only if possible, perhaps using the 'portal_membership'
-          tool;  otherwise, return 'userid'.
-
-        o Used to map userid's for Creator, Contributor DCMI queries.
-        """
-
-    def getPublisher():
-        """ Return the "formal" name of the publisher of the site.
-        """
-
-    #
-    #   Content-specific queries, for Dublin Core metadata.
-    #
-    def listAllowedSubjects(content=None):
-        """ List the allowed values of the 'Subject' DCMI element.
-
-        o 'Subject' elements should be keywords categorizing their resource.
-
-        o Return only values appropriate for content's type, or all values
-          if content is None.
-        """
-
-    def listAllowedFormats(content=None):
-        """ List the allowed values of the 'Format' DCMI element.
-
-        o These items should be usable as HTTP 'Content-type' values.
-
-        o Return only values appropriate for content's type, or all values
-          if content is None.
-        """
-
-    def listAllowedLanguages(content=None):
-        """ List the allowed values of the 'Language' DCMI element.
-
-        o 'Language' element values should be suitable for generating
-          HTTP headers.
-
-        o Return only values appropriate for content's type, or all values if
-          content is None.
-        """
-
-    def listAllowedRights(content=None):
-        """ List the allowed values of the 'Rights' DCMI element.
-
-        o The 'Rights' element describes copyright or other IP declarations
-          pertaining to a resource.
-
-        o Return only values appropriate for content's type, or all values if
-          content is None.
-        """
-
-    #
-    #   Validation policy hooks.
-    #
-    def setInitialMetadata(content):
-        """ Set initial values for content metatdata.
-        
-        o Supply any site-specific defaults.
-        """
-
-    def validateMetadata(content):
-        """ Enforce portal-wide policies about metadata.
-        
-        o E.g., policies may require non-empty title/description, etc.
-        
-        o This method may be called by view / workflow code at "appropriate"
-          times, such as immediately before saving changes to the metadata of
-          an object.
-        """
+# BBB: module will be removed in CMF 2.2
+#      zope2 interfaces created on runtime:
+#      - portal_metadata

Modified: CMF/trunk/CMFCore/interfaces/portal_properties.py
===================================================================
--- CMF/trunk/CMFCore/interfaces/portal_properties.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFCore/interfaces/portal_properties.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -15,31 +15,6 @@
 $Id$
 """
 
-from Interface import Attribute
-from Interface import Interface
-
-
-class portal_properties(Interface):
-    """ CMF Properties Tool interface.
-
-    This interface provides access to "portal-wide" properties.
-    """
-    id = Attribute('id', 'Must be set to "portal_properties"')
-
-    def editProperties(props):
-        """ Change portal settings.
-
-        Permission -- Manage portal
-        """
-
-    def title():
-        """ Get portal title.
-
-        Returns -- String
-        """
-
-    def smtp_server():
-        """ Get local SMTP server.
-
-        Returns -- String
-        """
+# BBB: module will be removed in CMF 2.2
+#      zope2 interfaces created on runtime:
+#      - portal_properties

Modified: CMF/trunk/CMFCore/interfaces/portal_registration.py
===================================================================
--- CMF/trunk/CMFCore/interfaces/portal_registration.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFCore/interfaces/portal_registration.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -15,64 +15,6 @@
 $Id$
 """
 
-from Interface import Attribute
-from Interface import Interface
-
-
-class portal_registration(Interface):
-    '''Establishes policies for member registration. Depends on
-    portal_membership. Is not aware of membership storage details.
-    '''
-    id = Attribute('id', 'Must be set to "portal_registration"')
-
-    #isRegistrationAllowed__roles__ = None  # Anonymous permission
-    def isRegistrationAllowed(REQUEST):
-        '''Returns a boolean value indicating whether the user
-        is allowed to add a member to the portal.
-        '''
-
-    #testPasswordValidity__roles__ = None  # Anonymous permission
-    def testPasswordValidity(password, confirm=None):
-        '''If the password is valid, returns None.  If not, returns
-        a string explaining why.
-        '''
-
-    #testPropertiesValidity__roles__ = None  # Anonymous permission
-    def testPropertiesValidity(new_properties, member=None):
-        '''If the properties are valid, returns None.  If not, returns
-        a string explaining why.
-        '''
-
-    #generatePassword__roles__ = None  # Anonymous permission
-    def generatePassword():
-        '''Generates a password which is guaranteed to comply
-        with the password policy.
-        '''
-
-    # permission: 'Add portal member'
-    def addMember(id, password, roles=('Member',), domains='',
-                  properties=None):
-        '''Creates a PortalMember and returns it. The properties argument
-        can be a mapping with additional member properties. Raises an
-        exception if the given id already exists, the password does not
-        comply with the policy in effect, or the authenticated user is not
-        allowed to grant one of the roles listed (where Member is a special
-        role that can always be granted); these conditions should be
-        detected before the fact so that a cleaner message can be printed.
-        '''
-
-    # permission: 'Add portal member'
-    def isMemberIdAllowed(id):
-        '''Returns 1 if the ID is not in use and is not reserved.
-        '''
-
-    #afterAdd__roles__ = ()  # No permission.
-    def afterAdd(member, id, password, properties):
-        '''Called by portal_registration.addMember()
-        after a member has been added successfully.'''
-
-    # permission: 'Mail forgotten password'
-    def mailPassword(forgotten_userid, REQUEST):
-        '''Email a forgotten password to a member.  Raises an exception
-        if user ID is not found.
-        '''
+# BBB: module will be removed in CMF 2.2
+#      zope2 interfaces created on runtime:
+#      - portal_registration

Modified: CMF/trunk/CMFCore/interfaces/portal_skins.py
===================================================================
--- CMF/trunk/CMFCore/interfaces/portal_skins.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFCore/interfaces/portal_skins.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -15,58 +15,7 @@
 $Id$
 """
 
-from Interface import Attribute
-from Interface import Interface
-
-
-class SkinsContainer(Interface):
-    """ An object that provides skins.
-    """
-
-    def getSkinPath(name):
-        """ Convert a skin name to a skin path.
-
-        Permission -- Access contents information
-        """
-
-    def getDefaultSkin():
-        """ Get the default skin name.
-
-        Permission -- Access contents information
-        """
-
-    def getRequestVarname():
-        """ Get the variable name to look for in the REQUEST.
-
-        Permission -- Access contents information
-        """
-
-    def getSkinByPath(path, raise_exc=0):
-        """ Get a skin at the given path.
-
-        A skin path is of the format:
-        'some/path, some/other/path, ...'  The first part has precedence.
-
-        A skin is a specially wrapped object that looks through the layers
-        in the correct order.
-
-        Permission -- Python only
-        """
-
-    def getSkinByName(name):
-        """ Get the named skin.
-
-        Permission -- Python only
-        """
-
-
-class portal_skins(SkinsContainer):
-    """ An object that provides skins to a portal object.
-    """
-    id = Attribute('id', 'Must be set to "portal_skins"')
-
-    def getSkinSelections():
-        """ Get the sorted list of available skin names.
-
-        Permission -- Always available
-        """
+# BBB: module will be removed in CMF 2.2
+#      zope2 interfaces created on runtime:
+#      - SkinsContainer
+#      - portal_skins

Modified: CMF/trunk/CMFCore/interfaces/portal_types.py
===================================================================
--- CMF/trunk/CMFCore/interfaces/portal_types.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFCore/interfaces/portal_types.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -15,135 +15,7 @@
 $Id$
 """
 
-from Interface import Attribute
-from Interface import Interface
-
-
-class ContentTypeInformation(Interface):
-    """
-        Registry entry interface.
-    """
-    def Metatype():
-        """
-            Return the Zope 'meta_type' for this content object.
-
-        o Deprecated (not all objects of a given type may even share
-          the same meta_type).
-        """
-
-    def Title():
-        """
-            Return the "human readable" type name (note that it
-            may not map exactly to the 'meta_type', e.g., for
-            l10n/i18n or where a single content class is being
-            used twice, under different names.
-        """
-
-    def Description():
-        """
-            Textual description of the class of objects (intended
-            for display in a "constructor list").
-        """
-
-    def isConstructionAllowed(container):
-        """
-        Does the current user have the permission required in
-        order to construct an instance?
-        """
-
-    def allowType(contentType):
-        """
-            Can objects of 'contentType' be added to containers whose
-            type object we are?
-        """
-
-    def constructInstance(container, id):
-        """
-            Build a "bare" instance of the appropriate type in
-            'container', using 'id' as its id.  Return the instance,
-            seated in the container.
-        """
-
-    def allowDiscussion():
-        """
-            Can this type of object support discussion?
-        """
-
-    def getIcon():
-        """
-            Returns the portal-relative icon for this type.
-        """
-
-    def getMethodAliases():
-        """ Get method aliases dict.
-
-        Permission -- Manage portal
-
-        Returns -- Dictionary
-        """
-
-    def setMethodAliases(aliases):
-        """ Set method aliases dict.
-
-        Permission -- Manage portal
-
-        Returns -- Boolean value
-        """
-
-    def queryMethodID(alias, default=None, context=None):
-        """ Query method ID by alias.
-        
-        context points to the object that calls queryMethodID. It may be used to
-        return dynamic values based on the caller.
-
-        Permission -- Always available
-
-        Returns -- Method ID or default value
-        """
-
-
-class portal_types(Interface):
-    """
-        Provides a configurable registry of portal content types.
-    """
-    id = Attribute('id', 'Must be set to "portal_types"')
-
-    # getType__roles__ = None  # Public
-    def getTypeInfo(contentType):
-        """
-            Return an instance which implements the
-            ContentTypeInformation interface, corresponding to
-            the specified 'contentType'.  If contentType is actually
-            an object, rather than a string, attempt to look up
-            the appropriate type info using its portal_type.
-        """
-
-    # listTypeInfo__roles__ = None  # Public
-    def listTypeInfo(container=None):
-        """
-            Return a sequence of instances which implement the
-            ContentTypeInformation interface, one for each content
-            type regisetered in the portal.  If the container
-            is specified, the list will be filtered according to
-            the user's permissions.
-        """
-
-    def listContentTypes(container=None, by_metatype=0):
-        """ List type info IDs.
-
-        If 'container' is passed, then filter the list to include only types
-        which are addable in 'container'.
-
-        Passing 'by_metatype' is deprecated (type information may not
-        correspond 1:1 to an underlying meta_type). This argument will be
-        removed when CMFCore/dtml/catalogFind.dtml doesn't need it anymore.
-        """
-
-    def constructContent(contentType, container, id, RESPONSE=None
-                        , *args, **kw):
-        """
-            Build an instance of the appropriate content class in
-            'container', using 'id'.  If RESPONSE is provided, redirect
-            to the new object's "initial view", otherwise return the
-            new object's Id string.
-        """
+# BBB: module will be removed in CMF 2.2
+#      zope2 interfaces created on runtime:
+#      - ContentTypeInformation
+#      - portal_types

Modified: CMF/trunk/CMFCore/interfaces/portal_undo.py
===================================================================
--- CMF/trunk/CMFCore/interfaces/portal_undo.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFCore/interfaces/portal_undo.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -15,24 +15,6 @@
 $Id$
 """
 
-from Interface import Attribute
-from Interface import Interface
-
-
-class portal_undo(Interface):
-    '''Provides access to Zope undo functions.
-    '''
-    id = Attribute('id', 'Must be set to "portal_undo"')
-
-    # permission: 'Undo changes'
-    def listUndoableTransactionsFor(object,
-                                    first_transaction=None,
-                                    last_transaction=None,
-                                    PrincipiaUndoBatchSize=None):
-        '''Lists all transaction IDs the user is allowed to undo.
-        '''
-
-    # permission: 'Undo changes'
-    def undo(object, transaction_info):
-        '''Performs an undo operation.
-        '''
+# BBB: module will be removed in CMF 2.2
+#      zope2 interfaces created on runtime:
+#      - portal_undo

Modified: CMF/trunk/CMFCore/interfaces/portal_url.py
===================================================================
--- CMF/trunk/CMFCore/interfaces/portal_url.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFCore/interfaces/portal_url.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -15,69 +15,6 @@
 $Id$
 """
 
-from Interface import Attribute
-from Interface import Interface
-
-
-class portal_url(Interface):
-    """ CMF URL Tool interface.
-
-    This interface provides a common mechanism for finding the 'root'
-    object of a CMFSite, and for computing paths to objects relative to
-    that root.
-    """
-    id = Attribute('id', 'Must be set to "portal_url"')
-
-    def __call__(relative=0, *args, **kw):
-        """ Get by default the absolute URL of the portal.
-
-        Permission -- Always available
-
-        Returns -- Slash-separated string
-        """
-
-    def getPortalObject():
-        """ Get the portal object itself.
-
-        Permission -- Always available
-
-        Returns -- CMFSite object
-        """
-
-    def getRelativeContentPath(content):
-        """ Get the path for an object, relative to the portal root.
-
-        Permission -- Always available
-
-        Returns -- Tuple of IDs
-        """
-
-    def getRelativeContentURL(content):
-        """ Get the URL for an object, relative to the portal root.
-
-        This is helpful for virtual hosting situations.
-        Same method as 'getRelativeURL()'
-
-        Permission -- Always available
-
-        Returns -- Slash-separated string
-        """
-
-    def getRelativeUrl(content):
-        """ Get the URL for an object, relative to the portal root.
-
-        This is helpful for virtual hosting situations.
-        Same method as 'getRelativeContentURL()'
-
-        Permission -- Always available
-
-        Returns -- Slash-separated string
-        """
-
-    def getPortalPath():
-        """ Get the portal object's URL without the server URL component.
-
-        Permission -- Always available
-
-        Returns -- Slash-separated string
-        """
+# BBB: module will be removed in CMF 2.2
+#      zope2 interfaces created on runtime:
+#      - portal_url

Modified: CMF/trunk/CMFCore/interfaces/portal_workflow.py
===================================================================
--- CMF/trunk/CMFCore/interfaces/portal_workflow.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFCore/interfaces/portal_workflow.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -15,203 +15,7 @@
 $Id$
 """
 
-from Interface import Attribute
-from Interface import Interface
-
-_marker = []
-
-
-class portal_workflow(Interface):
-    '''This tool accesses and changes the workflow state of content.
-    '''
-    id = Attribute('id', 'Must be set to "portal_workflow"')
-
-    # security.declarePrivate('getCatalogVariablesFor')
-    def getCatalogVariablesFor(ob):
-        '''
-        Invoked by portal_catalog.  Allows workflows
-        to add variables to the catalog based on workflow status,
-        making it possible to implement queues.
-        Returns a mapping containing the catalog variables
-        that apply to ob.
-        '''
-
-    # security.declarePublic('getActionsFor')
-    def getActionsFor(ob):
-        '''
-        This method is deprecated and will be removed in CMF 1.7. 
-
-        Return a list of action dictionaries for 'ob', just as though
-        queried via 'ActionsTool.listFilteredActionsFor'.
-        '''
-
-    # security.declarePublic('doActionFor')
-    def doActionFor(ob, action, wf_id=None, *args, **kw):
-        '''
-        Invoked by user interface code.
-        Allows the user to request a workflow action.  The workflow object
-        must perform its own security checks.
-        '''
-
-    # security.declarePublic('getInfoFor')
-    def getInfoFor(ob, name, default=_marker, wf_id=None, *args, **kw):
-        '''
-        Invoked by user interface code.  Allows the user to request
-        information provided by the workflow.  The workflow object
-        must perform its own security checks.
-        '''
-
-    # security.declarePrivate('notifyCreated')
-    def notifyCreated(ob):
-        '''
-        Notifies all applicable workflows after an object has been created
-        and put in its new place.
-        '''
-
-    # security.declarePrivate('notifyBefore')
-    def notifyBefore(ob, action):
-        '''
-        Notifies all applicable workflows of an action before it happens,
-        allowing veto by exception.  Unless an exception is thrown, either
-        a notifySuccess() or notifyException() can be expected later on.
-        The action usually corresponds to a method name.
-        '''
-
-    # security.declarePrivate('notifySuccess')
-    def notifySuccess(ob, action, result=None):
-        '''
-        Notifies all applicable workflows that an action has taken place.
-        '''
-
-    # security.declarePrivate('notifyException')
-    def notifyException(ob, action, exc):
-        '''
-        Notifies all applicable workflows that an action failed.
-        '''
-
-    # security.declarePrivate('getHistoryOf')
-    def getHistoryOf(wf_id, ob):
-        '''
-        Invoked by workflow definitions.  Returns the history
-        of an object.
-        '''
-
-    # security.declarePrivate('getStatusOf')
-    def getStatusOf(wf_id, ob):
-        '''
-        Invoked by workflow definitions.  Returns the last element of a
-        history.
-        '''
-
-    # security.declarePrivate('setStatusOf')
-    def setStatusOf(wf_id, ob, status):
-        '''
-        Invoked by workflow definitions.  Appends to the workflow history.
-        '''
-
-
-class WorkflowDefinition(Interface):
-    '''The interface expected of workflow definitions objects.
-    Accesses and changes the workflow state of objects.
-    '''
-
-    # security.declarePrivate('getCatalogVariablesFor')
-    def getCatalogVariablesFor(ob):
-        '''
-        Invoked by the portal_workflow tool.
-        Allows this workflow to make workflow-specific variables
-        available to the catalog, making it possible to implement
-        queues in a simple way.
-        Returns a mapping containing the catalog variables
-        that apply to ob.
-        '''
-
-    #security.declarePrivate('updateRoleMappingsFor')
-    def updateRoleMappingsFor(ob):
-        '''
-        Updates the object permissions according to the current
-        workflow state.
-        '''
-
-    # security.declarePrivate('listObjectActions')
-    def listObjectActions(info):
-        '''
-        Invoked by the portal_workflow tool.
-        Allows this workflow to
-        include actions to be displayed in the actions box.
-        Called only when this workflow is applicable to
-        info.content.
-        Returns the actions to be displayed to the user.
-        '''
-
-    # security.declarePrivate('listGlobalActions')
-    def listGlobalActions(info):
-        '''
-        Invoked by the portal_workflow tool.
-        Allows this workflow to
-        include actions to be displayed in the actions box.
-        Generally called on every request!
-        Returns the actions to be displayed to the user.
-        '''
-
-    # security.declarePrivate('isActionSupported')
-    def isActionSupported(ob, action):
-        '''
-        Invoked by the portal_workflow tool.
-        Returns a true value if the given action name is supported.
-        '''
-
-    # security.declarePrivate('doActionFor')
-    def doActionFor(ob, action, comment=''):
-        '''
-        Invoked by the portal_workflow tool.
-        Allows the user to request a workflow action.  This method
-        must perform its own security checks.
-        '''
-
-    # security.declarePrivate('isInfoSupported')
-    def isInfoSupported(ob, name):
-        '''
-        Invoked by the portal_workflow tool.
-        Returns a true value if the given info name is supported.
-        '''
-
-    # security.declarePrivate('getInfoFor')
-    def getInfoFor(ob, name, default):
-        '''
-        Invoked by the portal_workflow tool.
-        Allows the user to request information provided by the
-        workflow.  This method must perform its own security checks.
-        '''
-
-    # security.declarePrivate('notifyCreated')
-    def notifyCreated(ob):
-        '''
-        Invoked by the portal_workflow tool.
-        Notifies this workflow after an object has been created
-        and put in its new place.
-        '''
-
-    # security.declarePrivate('notifyBefore')
-    def notifyBefore(ob, action):
-        '''
-        Invoked by the portal_workflow tool.
-        Notifies this workflow of an action before it happens,
-        allowing veto by exception.  Unless an exception is thrown, either
-        a notifySuccess() or notifyException() can be expected later on.
-        The action usually corresponds to a method name.
-        '''
-
-    # security.declarePrivate('notifySuccess')
-    def notifySuccess(ob, action, result):
-        '''
-        Invoked by the portal_workflow tool.
-        Notifies this workflow that an action has taken place.
-        '''
-
-    # security.declarePrivate('notifyException')
-    def notifyException(ob, action, exc):
-        '''
-        Invoked by the portal_workflow tool.
-        Notifies this workflow that an action failed.
-        '''
+# BBB: module will be removed in CMF 2.2
+#      zope2 interfaces created on runtime:
+#      - portal_workflow
+#      - WorkflowDefinition

Modified: CMF/trunk/CMFDefault/DefaultWorkflow.py
===================================================================
--- CMF/trunk/CMFDefault/DefaultWorkflow.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFDefault/DefaultWorkflow.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -21,9 +21,11 @@
 from AccessControl import ClassSecurityInfo
 from DateTime import DateTime
 from Globals import InitializeClass
+from zope.interface import implements
 
+from Products.CMFCore.interfaces import IWorkflowDefinition
 from Products.CMFCore.interfaces.portal_workflow \
-        import WorkflowDefinition as IWorkflowDefinition
+        import WorkflowDefinition as z2IWorkflowDefinition
 from Products.CMFCore.utils import _checkPermission
 from Products.CMFCore.utils import _modifyPermissionMappings
 from Products.CMFCore.utils import getToolByName
@@ -37,10 +39,12 @@
 
 
 class DefaultWorkflowDefinition (SimpleItemWithProperties):
+
     """ Default workflow definition.
     """
 
-    __implements__ = IWorkflowDefinition
+    implements(IWorkflowDefinition)
+    __implements__ = z2IWorkflowDefinition
 
     meta_type = 'Workflow'
     id = 'default_workflow'

Modified: CMF/trunk/CMFDefault/DiscussionItem.py
===================================================================
--- CMF/trunk/CMFDefault/DiscussionItem.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFDefault/DiscussionItem.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -22,9 +22,14 @@
 from Globals import Persistent
 from Globals import PersistentMapping
 from OFS.Traversable import Traversable
+from zope.interface import implements
 
-from Products.CMFCore.interfaces.Discussions import Discussable
-from Products.CMFCore.interfaces.Discussions import DiscussionResponse
+from Products.CMFCore.interfaces import IDiscussable
+from Products.CMFCore.interfaces import IDiscussionResponse
+from Products.CMFCore.interfaces.Discussions \
+        import Discussable as z2IDiscussable
+from Products.CMFCore.interfaces.Discussions \
+        import DiscussionResponse as z2IDiscussionResponse
 from Products.CMFCore.utils import getToolByName
 
 from Document import Document
@@ -62,9 +67,9 @@
 
 def addDiscussionItem(self, id, title, description, text_format, text,
                       reply_to, RESPONSE=None):
-    """
-    Add a discussion item
 
+    """ Add a discussion item
+
     'title' is also used as the subject header
     if 'description' is blank, it is filled with the contents of 'title'
     'reply_to' is the object (or path to the object) which this is a reply to
@@ -89,11 +94,12 @@
 
 
 class DiscussionItem(Document):
+
+    """ Class for content which is a response to other content.
     """
-        Class for content which is a response to other content.
-    """
 
-    __implements__ = (DiscussionResponse, Document.__implements__)
+    implements(IDiscussionResponse)
+    __implements__ = (z2IDiscussionResponse, Document.__implements__)
 
     meta_type           = 'Discussion Item'
     portal_type         = 'Discussion Item'
@@ -117,12 +123,11 @@
         return self.creators
 
     #
-    #   DiscussionResponse interface
+    #   IDiscussionResponse interface
     #
     security.declareProtected(View, 'inReplyTo')
     def inReplyTo( self, REQUEST=None ):
-        """
-            Return the Discussable object to which we are a reply.
+        """ Return the IDiscussable object to which we are a reply.
 
             Two cases obtain:
 
@@ -171,6 +176,7 @@
 
 
 class DiscussionItemContainer( Persistent, Implicit, Traversable ):
+
     """
         Store DiscussionItem objects. Discussable content that
         has DiscussionItems associated with it will have an
@@ -178,7 +184,8 @@
         hold the discussion threads.
     """
 
-    __implements__ = Discussable
+    implements(IDiscussable)
+    __implements__ = z2IDiscussable
 
     # for the security machinery to allow traversal
     #__roles__ = None
@@ -283,7 +290,7 @@
         return self._container.values()
 
     #
-    #   Discussable interface
+    #   IDiscussable interface
     #
     security.declareProtected(ReplyToItem, 'createReply')
     def createReply( self, title, text, Creator=None, text_format='structured-text' ):
@@ -368,8 +375,7 @@
 
     security.declareProtected(View, 'getReplies')
     def getReplies( self ):
-        """
-            Return a sequence of the DiscussionResponse objects which are
+        """ Return a sequence of the IDiscussionResponse objects which are
             associated with this Discussable
         """
         objects = []

Modified: CMF/trunk/CMFDefault/DiscussionTool.py
===================================================================
--- CMF/trunk/CMFDefault/DiscussionTool.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFDefault/DiscussionTool.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -20,12 +20,14 @@
 from Globals import DTMLFile
 from Globals import InitializeClass
 from OFS.SimpleItem import SimpleItem
+from zope.interface import implements
 
 from Products.CMFCore.ActionProviderBase import ActionProviderBase
+from Products.CMFCore.interfaces import IDiscussionTool
 from Products.CMFCore.interfaces.Discussions \
-        import DiscussionResponse as IDiscussionResponse
+        import DiscussionResponse as z2IDiscussionResponse
 from Products.CMFCore.interfaces.portal_discussion \
-        import portal_discussion as IDiscussionTool
+        import portal_discussion as z2IDiscussionTool
 from Products.CMFCore.utils import getToolByName
 from Products.CMFCore.utils import UniqueObject
 
@@ -43,7 +45,8 @@
     """ Links content to discussions.
     """
 
-    __implements__ = (IDiscussionTool, ActionProviderBase.__implements__)
+    implements(IDiscussionTool)
+    __implements__ = (z2IDiscussionTool, ActionProviderBase.__implements__)
 
     id = 'portal_discussion'
     meta_type = 'Default Discussion Tool'
@@ -86,7 +89,7 @@
         if not self.isDiscussionAllowedFor( content ):
             raise DiscussionNotAllowed
 
-        if not IDiscussionResponse.isImplementedBy(content) and \
+        if not z2IDiscussionResponse.isImplementedBy(content) and \
                 getattr( aq_base(content), 'talkback', None ) is None:
             # Discussion Items use the DiscussionItemContainer object of the
             # related content item, so only create one for other content items

Modified: CMF/trunk/CMFDefault/Document.py
===================================================================
--- CMF/trunk/CMFDefault/Document.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFDefault/Document.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -15,6 +15,7 @@
 $Id$
 """
 
+import transaction
 from AccessControl import ClassSecurityInfo
 from AccessControl import getSecurityManager
 from Acquisition import aq_base
@@ -22,7 +23,7 @@
 from Globals import DTMLFile
 from Globals import InitializeClass
 from StructuredText.StructuredText import HTML
-import transaction
+from zope.interface import implements
 
 from Products.CMFCore.PortalContent import PortalContent
 from Products.CMFCore.utils import contributorsplitter
@@ -31,8 +32,10 @@
 from DublinCore import DefaultDublinCoreImpl
 from exceptions import EditingConflict
 from exceptions import ResourceLockedError
-from interfaces.Document import IDocument
-from interfaces.Document import IMutableDocument
+from interfaces import IDocument
+from interfaces import IMutableDocument
+from interfaces.Document import IDocument as z2IDocument
+from interfaces.Document import IMutableDocument as z2IMutableDocument
 from permissions import ModifyPortalContent
 from permissions import View
 from utils import _dtmldir
@@ -84,9 +87,11 @@
 
 
 class Document(PortalContent, DefaultDublinCoreImpl):
+
     """ A Document - Handles both StructuredText and HTML """
 
-    __implements__ = (IDocument, IMutableDocument,
+    implements(IDocument, IMutableDocument)
+    __implements__ = (z2IDocument, z2IMutableDocument,
                       PortalContent.__implements__,
                       DefaultDublinCoreImpl.__implements__)
 

Modified: CMF/trunk/CMFDefault/DublinCore.py
===================================================================
--- CMF/trunk/CMFDefault/DublinCore.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFDefault/DublinCore.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -21,10 +21,17 @@
 from Globals import DTMLFile
 from Globals import InitializeClass
 from OFS.PropertyManager import PropertyManager
+from zope.interface import implements
 
-from Products.CMFCore.interfaces.DublinCore import CatalogableDublinCore
-from Products.CMFCore.interfaces.DublinCore import DublinCore
-from Products.CMFCore.interfaces.DublinCore import MutableDublinCore
+from Products.CMFCore.interfaces import ICatalogableDublinCore
+from Products.CMFCore.interfaces import IDublinCore
+from Products.CMFCore.interfaces import IMutableDublinCore
+from Products.CMFCore.interfaces.DublinCore \
+        import CatalogableDublinCore as z2ICatalogableDublinCore
+from Products.CMFCore.interfaces.DublinCore \
+        import DublinCore as z2IDublinCore
+from Products.CMFCore.interfaces.DublinCore \
+        import MutableDublinCore as z2IMutableDublinCore
 from Products.CMFCore.utils import getToolByName
 
 from permissions import ModifyPortalContent
@@ -38,12 +45,17 @@
 # For http://www.zope.org/Collectors/CMF/325
 # We only really need this once, at startup.
 _zone = DateTime().timezone()
-    
+
+
 class DefaultDublinCoreImpl( PropertyManager ):
+
     """ Mix-in class which provides Dublin Core methods.
     """
-    __implements__ = DublinCore, CatalogableDublinCore, MutableDublinCore
 
+    implements(IDublinCore, ICatalogableDublinCore, IMutableDublinCore)
+    __implements__ = (z2IDublinCore, z2ICatalogableDublinCore,
+                      z2IMutableDublinCore)
+
     security = ClassSecurityInfo()
 
     def __init__( self

Modified: CMF/trunk/CMFDefault/MembershipTool.py
===================================================================
--- CMF/trunk/CMFDefault/MembershipTool.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFDefault/MembershipTool.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -21,6 +21,7 @@
 from Acquisition import aq_parent
 from Globals import DTMLFile
 from Globals import InitializeClass
+from zope.interface import implements
 
 from Products.CMFCore.ActionProviderBase import ActionProviderBase
 from Products.CMFCore.MembershipTool import MembershipTool as BaseTool
@@ -29,8 +30,9 @@
 from Products.CMFCore.utils import getToolByName
 
 from Document import addDocument
+from interfaces import IMembershipTool
 from interfaces.portal_membership \
-        import portal_membership as IMembershipTool
+        import portal_membership as z2IMembershipTool
 from permissions import ListPortalMembers
 from permissions import ManagePortal
 from permissions import ManageUsers
@@ -54,7 +56,8 @@
     """ Implement 'portal_membership' interface using "stock" policies.
     """
 
-    __implements__ = (IMembershipTool, ActionProviderBase.__implements__)
+    implements(IMembershipTool)
+    __implements__ = (z2IMembershipTool, ActionProviderBase.__implements__)
 
     meta_type = 'Default Membership Tool'
     membersfolder_id = 'Members'

Modified: CMF/trunk/CMFDefault/MetadataTool.py
===================================================================
--- CMF/trunk/CMFDefault/MetadataTool.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFDefault/MetadataTool.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -21,10 +21,12 @@
 from Globals import InitializeClass
 from Globals import PersistentMapping
 from OFS.SimpleItem import SimpleItem
+from zope.interface import implements
 
 from Products.CMFCore.ActionProviderBase import ActionProviderBase
+from Products.CMFCore.interfaces import IMetadataTool
 from Products.CMFCore.interfaces.portal_metadata \
-        import portal_metadata as IMetadataTool
+        import portal_metadata as z2IMetadataTool
 from Products.CMFCore.utils import UniqueObject
 
 from exceptions import MetadataError
@@ -204,7 +206,8 @@
 
 class MetadataTool( UniqueObject, SimpleItem, ActionProviderBase ):
 
-    __implements__ = (IMetadataTool, ActionProviderBase.__implements__)
+    implements(IMetadataTool)
+    __implements__ = (z2IMetadataTool, ActionProviderBase.__implements__)
 
     id = 'portal_metadata'
     meta_type = 'Default Metadata Tool'

Modified: CMF/trunk/CMFDefault/PropertiesTool.py
===================================================================
--- CMF/trunk/CMFDefault/PropertiesTool.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFDefault/PropertiesTool.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -19,10 +19,12 @@
 from Acquisition import aq_inner, aq_parent
 from Globals import InitializeClass, DTMLFile
 from OFS.SimpleItem import SimpleItem
+from zope.interface import implements
 
 from Products.CMFCore.ActionProviderBase import ActionProviderBase
+from Products.CMFCore.interfaces import IPropertiesTool
 from Products.CMFCore.interfaces.portal_properties \
-        import portal_properties as IPropertiesTool
+        import portal_properties as z2IPropertiesTool
 from Products.CMFCore.utils import UniqueObject
 
 from permissions import ManagePortal
@@ -31,7 +33,8 @@
 
 class PropertiesTool(UniqueObject, SimpleItem, ActionProviderBase):
 
-    __implements__ = (IPropertiesTool, ActionProviderBase.__implements__)
+    implements(IPropertiesTool)
+    __implements__ = (z2IPropertiesTool, ActionProviderBase.__implements__)
 
     id = 'portal_properties'
     meta_type = 'Default Properties Tool'

Deleted: CMF/trunk/CMFDefault/bridge.zcml
===================================================================
--- CMF/trunk/CMFDefault/bridge.zcml	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFDefault/bridge.zcml	2005-09-24 15:24:32 UTC (rev 38590)
@@ -1,23 +0,0 @@
-<configure
-    xmlns="http://namespaces.zope.org/five"
-    >
-
-  <bridge
-      zope2=".interfaces.Document.IDocument"
-      package=".interfaces"
-      name="IDocument"
-      />
-
-  <bridge
-      zope2=".interfaces.Document.IMutableDocument"
-      package=".interfaces"
-      name="IMutableDocument"
-      />
-
-  <bridge
-      zope2=".interfaces.portal_membership.portal_membership"
-      package=".interfaces"
-      name="IMembershipTool"
-      />
-
-</configure>

Modified: CMF/trunk/CMFDefault/configure.zcml
===================================================================
--- CMF/trunk/CMFDefault/configure.zcml	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFDefault/configure.zcml	2005-09-24 15:24:32 UTC (rev 38590)
@@ -2,10 +2,6 @@
     xmlns="http://namespaces.zope.org/zope"
     >
 
-  <include file="bridge.zcml"/>
-
-  <include file="implements.zcml"/>
-
   <include package=".browser"/>
 
 </configure>

Deleted: CMF/trunk/CMFDefault/implements.zcml
===================================================================
--- CMF/trunk/CMFDefault/implements.zcml	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFDefault/implements.zcml	2005-09-24 15:24:32 UTC (rev 38590)
@@ -1,81 +0,0 @@
-<configure
-    xmlns="http://namespaces.zope.org/five"
-    >
-
-  <!-- DefaultWorkflow -->
-
-  <implements
-      class=".DefaultWorkflow.DefaultWorkflowDefinition"
-      interface="Products.CMFCore.interfaces.IWorkflowDefinition"
-      />
-
-  <!-- DiscussionItem -->
-
-  <implements
-      class=".DiscussionItem.DiscussionItem"
-      interface="Products.CMFCore.interfaces.IDiscussionResponse"
-      />
-
-  <implements
-      class=".DiscussionItem.DiscussionItemContainer"
-      interface="Products.CMFCore.interfaces.IDiscussable"
-      />
-
-  <!-- DiscussionTool -->
-
-  <implements
-      class=".DiscussionTool.DiscussionTool"
-      interface="Products.CMFCore.interfaces.IDiscussionTool"
-      />
-
-  <!-- Document -->
-
-  <implements
-      class=".Document.Document"
-      interface=".interfaces.IDocument"
-      />
-
-  <implements
-      class=".Document.Document"
-      interface=".interfaces.IMutableDocument"
-      />
-
-  <!-- DublinCore -->
-
-  <implements
-      class=".DublinCore.DefaultDublinCoreImpl"
-      interface="Products.CMFCore.interfaces.IDublinCore"
-      />
-
-  <implements
-      class=".DublinCore.DefaultDublinCoreImpl"
-      interface="Products.CMFCore.interfaces.ICatalogableDublinCore"
-      />
-
-  <implements
-      class=".DublinCore.DefaultDublinCoreImpl"
-      interface="Products.CMFCore.interfaces.IMutableDublinCore"
-      />
-
-  <!-- MembershipTool -->
-
-  <implements
-      class=".MembershipTool.MembershipTool"
-      interface=".interfaces.IMembershipTool"
-      />
-
-  <!-- MetadataTool -->
-
-  <implements
-      class=".MetadataTool.MetadataTool"
-      interface="Products.CMFCore.interfaces.IMetadataTool"
-      />
-
-  <!-- PropertiesTool -->
-
-  <implements
-      class=".PropertiesTool.PropertiesTool"
-      interface="Products.CMFCore.interfaces.IPropertiesTool"
-      />
-
-</configure>

Modified: CMF/trunk/CMFDefault/interfaces/Document.py
===================================================================
--- CMF/trunk/CMFDefault/interfaces/Document.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFDefault/interfaces/Document.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -15,32 +15,6 @@
 $Id$
 """
 
-from Interface import Interface
-
-
-class IDocument(Interface):
-
-    """ Textual content, in one of several formats.
-
-    o Allowed formats include: structured text, HTML, plain text.
-    """
-
-    def CookedBody():
-        """ Get the "cooked" (ready for presentation) form of the text.
-        """
-
-    def EditableBody():
-        """ Get the "raw" (as edited) form of the text.
-        """
-
-class IMutableDocument(IDocument):
-
-    """ Updatable form of IDocument.
-    """
-
-    def edit(text_format, text, file='', safety_belt=''):
-        """ Update the document.
-
-        o 'safety_belt', if passed, must match the value issued when the edit
-        began.
-        """
+# BBB: module will be removed in CMF 2.2
+#      zope2 interfaces created on runtime:
+#      - IDocument

Modified: CMF/trunk/CMFDefault/interfaces/__init__.py
===================================================================
--- CMF/trunk/CMFDefault/interfaces/__init__.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFDefault/interfaces/__init__.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -14,3 +14,18 @@
 
 $Id$
 """
+
+from _content import *
+from _tools import *
+
+# BBB: will be removed in CMF 2.2
+#      create zope2 interfaces
+from Interface.bridge import createZope3Bridge
+import Document
+import portal_membership
+
+createZope3Bridge(IDocument, Document, 'IDocument')
+createZope3Bridge(IMutableDocument, Document, 'IMutableDocument')
+createZope3Bridge(IMembershipTool, portal_membership, 'portal_membership')
+
+del createZope3Bridge

Copied: CMF/trunk/CMFDefault/interfaces/_content.py (from rev 38589, CMF/branches/goldegg-phase-1/CMFDefault/interfaces/_content.py)

Copied: CMF/trunk/CMFDefault/interfaces/_tools.py (from rev 38589, CMF/branches/goldegg-phase-1/CMFDefault/interfaces/_tools.py)

Modified: CMF/trunk/CMFDefault/interfaces/portal_membership.py
===================================================================
--- CMF/trunk/CMFDefault/interfaces/portal_membership.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFDefault/interfaces/portal_membership.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -15,20 +15,6 @@
 $Id$
 """
 
-from Products.CMFCore.interfaces.portal_membership \
-        import portal_membership as BaseInterface
-
-
-class portal_membership(BaseInterface):
-    """ Declare product-specific APIs for CMFDefault's tool.
-    """
-
-    def setMembersFolderById(id=''):
-        """ Set the members folder object by its id.
-
-        The members folder has to be in the same container as the membership
-        tool. id is the id of an existing folder. If id is empty, member areas
-        are disabled.
-
-        Permission -- Manage portal
-        """
+# BBB: module will be removed in CMF 2.2
+#      zope2 interfaces created on runtime:
+#      - portal_membership

Modified: CMF/trunk/CMFSetup/actions.py
===================================================================
--- CMF/trunk/CMFSetup/actions.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFSetup/actions.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -19,7 +19,8 @@
 from Globals import InitializeClass
 from Products.PageTemplates.PageTemplateFile import PageTemplateFile
 
-from Products.CMFCore.ActionProviderBase import IActionProvider
+from Products.CMFCore.interfaces.portal_actions \
+        import ActionProvider as IActionProvider
 from Products.CMFCore.utils import getToolByName
 
 from permissions import ManagePortal

Modified: CMF/trunk/CMFSetup/context.py
===================================================================
--- CMF/trunk/CMFSetup/context.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFSetup/context.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -17,446 +17,9 @@
 $Id$
 """
 
-import os
-import time
-from StringIO import StringIO
-from tarfile import TarFile
-from tarfile import TarInfo
-
-from AccessControl import ClassSecurityInfo
-from Acquisition import aq_inner
-from Acquisition import aq_parent
-from Acquisition import aq_self
-from Acquisition import Implicit
-from DateTime.DateTime import DateTime
-from Globals import InitializeClass
-from OFS.DTMLDocument import DTMLDocument
-from OFS.Folder import Folder
-from OFS.Image import File
-from OFS.Image import Image
-from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate
-from Products.PythonScripts.PythonScript import PythonScript
-
-from interfaces import IExportContext
-from interfaces import IImportContext
-from permissions import ManagePortal
-
-
-class DirectoryImportContext( Implicit ):
-
-    __implements__ = ( IImportContext, )
-
-    security = ClassSecurityInfo()
-
-    def __init__( self
-                , tool
-                , profile_path
-                , should_purge=False
-                , encoding=None
-                ):
-
-        self._site = aq_parent( aq_inner( tool ) )
-        self._profile_path = profile_path
-        self._should_purge = bool( should_purge )
-        self._encoding = encoding
-
-    security.declareProtected( ManagePortal, 'getSite' )
-    def getSite( self ):
-
-        """ See ISetupContext.
-        """
-        return aq_self(self._site)
-
-    security.declareProtected( ManagePortal, 'getEncoding' )
-    def getEncoding( self ):
-
-        """ See IImportContext.
-        """
-        return self._encoding
-
-    security.declareProtected( ManagePortal, 'readDataFile' )
-    def readDataFile( self, filename, subdir=None ):
-
-        """ See IImportContext.
-        """
-        if subdir is None:
-            full_path = os.path.join( self._profile_path, filename )
-        else:
-            full_path = os.path.join( self._profile_path, subdir, filename )
-
-        if not os.path.exists( full_path ):
-            return None
-
-        file = open( full_path, 'rb' )
-        result = file.read()
-        file.close()
-
-        return result
-
-    security.declareProtected( ManagePortal, 'getLastModified' )
-    def getLastModified( self, path ):
-
-        """ See IImportContext.
-        """
-        full_path = os.path.join( self._profile_path, path )
-
-        if not os.path.exists( full_path ):
-            return None
-
-        return DateTime( os.path.getmtime( full_path ) )
-
-    security.declareProtected( ManagePortal, 'isDirectory' )
-    def isDirectory( self, path ):
-
-        """ See IImportContext.
-        """
-        full_path = os.path.join( self._profile_path, path )
-
-        if not os.path.exists( full_path ):
-            return None
-
-        return os.path.isdir( full_path )
-
-    security.declareProtected( ManagePortal, 'listDirectory' )
-    def listDirectory( self, path, skip=('CVS', '.svn') ):
-
-        """ See IImportContext.
-        """
-        if path is None:
-            path = ''
-
-        full_path = os.path.join( self._profile_path, path )
-
-        if not os.path.exists( full_path ) or not os.path.isdir( full_path ):
-            return None
-
-        names = os.listdir( full_path )
-
-        return [ name for name in names if name not in skip ]
-
-    security.declareProtected( ManagePortal, 'shouldPurge' )
-    def shouldPurge( self ):
-
-        """ See IImportContext.
-        """
-        return self._should_purge
-
-InitializeClass( DirectoryImportContext )
-
-
-class DirectoryExportContext( Implicit ):
-
-    __implements__ = ( IExportContext, )
-
-    security = ClassSecurityInfo()
-
-    def __init__( self, tool, profile_path ):
-
-        self._site = aq_parent( aq_inner( tool ) )
-        self._profile_path = profile_path
-
-    security.declareProtected( ManagePortal, 'getSite' )
-    def getSite( self ):
-
-        """ See ISetupContext.
-        """
-        return aq_self(self._site)
-
-    security.declareProtected( ManagePortal, 'writeDataFile' )
-    def writeDataFile( self, filename, text, content_type, subdir=None ):
-
-        """ See IExportContext.
-        """
-        if subdir is None:
-            prefix = self._profile_path
-        else:
-            prefix = os.path.join( self._profile_path, subdir )
-
-        full_path = os.path.join( prefix, filename )
-
-        if not os.path.exists( prefix ):
-            os.makedirs( prefix )
-
-        mode = content_type.startswith( 'text/' ) and 'w' or 'wb'
-
-        file = open( full_path, mode )
-        file.write( text )
-        file.close()
-
-InitializeClass( DirectoryExportContext )
-
-
-class TarballExportContext( Implicit ):
-
-    __implements__ = ( IExportContext, )
-
-    security = ClassSecurityInfo()
-
-    def __init__( self, tool ):
-
-        self._site = aq_parent( aq_inner( tool ) )
-        timestamp = time.gmtime()
-        archive_name = ( 'portal_setup-%4d%02d%02d%02d%02d%02d.tar.gz'
-                       % timestamp[:6] )
-
-        self._archive_stream = StringIO()
-        self._archive_filename = archive_name
-        self._archive = TarFile.open( archive_name, 'w:gz'
-                                    , self._archive_stream )
-
-    security.declareProtected( ManagePortal, 'getSite' )
-    def getSite( self ):
-
-        """ See ISetupContext.
-        """
-        return aq_self(self._site)
-
-    security.declareProtected( ManagePortal, 'writeDataFile' )
-    def writeDataFile( self, filename, text, content_type, subdir=None ):
-
-        """ See IExportContext.
-        """
-        if subdir is not None:
-            filename = os.path.join( subdir, filename )
-
-        stream = StringIO( text )
-        info = TarInfo( filename )
-        info.size = len( text )
-        info.mtime = time.time()
-        self._archive.addfile( info, stream )
-
-    security.declareProtected( ManagePortal, 'getArchive' )
-    def getArchive( self ):
-
-        """ Close the archive, and return it as a big string.
-        """
-        self._archive.close()
-        return self._archive_stream.getvalue()
-
-    security.declareProtected( ManagePortal, 'getArchiveFilename' )
-    def getArchiveFilename( self ):
-
-        """ Close the archive, and return it as a big string.
-        """
-        return self._archive_filename
-
-InitializeClass( TarballExportContext )
-
-
-class SnapshotExportContext( Implicit ):
-
-    __implements__ = ( IExportContext, )
-
-    security = ClassSecurityInfo()
-
-    def __init__( self, tool, snapshot_id ):
-
-        self._tool = tool = aq_inner( tool )
-        self._site = aq_parent( tool )
-        self._snapshot_id = snapshot_id
-
-    security.declareProtected( ManagePortal, 'getSite' )
-    def getSite( self ):
-
-        """ See ISetupContext.
-        """
-        return aq_self(self._site)
-
-    security.declareProtected( ManagePortal, 'writeDataFile' )
-    def writeDataFile( self, filename, text, content_type, subdir=None ):
-
-        """ See IExportContext.
-        """
-        folder = self._ensureSnapshotsFolder( subdir )
-
-        # TODO: switch on content_type
-        ob = self._createObjectByType( filename, text, content_type )
-        folder._setObject( str( filename ), ob ) # No Unicode IDs!
-
-    security.declareProtected( ManagePortal, 'getSnapshotURL' )
-    def getSnapshotURL( self ):
-
-        """ See IExportContext.
-        """
-        return '%s/%s' % ( self._tool.absolute_url(), self._snapshot_id )
-
-    security.declareProtected( ManagePortal, 'getSnapshotFolder' )
-    def getSnapshotFolder( self ):
-
-        """ See IExportContext.
-        """
-        return self._ensureSnapshotsFolder()
-
-    #
-    #   Helper methods
-    #
-    security.declarePrivate( '_createObjectByType' )
-    def _createObjectByType( self, name, body, content_type ):
-
-        if name.endswith('.py'):
-
-            ob = PythonScript( name )
-            ob.write( body )
-
-        elif name.endswith('.dtml'):
-
-            ob = DTMLDocument( '', __name__=name )
-            ob.munge( body )
-
-        elif content_type in ('text/html', 'text/xml' ):
-
-            ob = ZopePageTemplate( name, str( body )
-                                 , content_type=content_type )
-
-        elif content_type[:6]=='image/':
-
-            ob=Image( name, '', body, content_type=content_type )
-
-        else:
-            ob=File( name, '', body, content_type=content_type )
-
-        return ob
-
-    security.declarePrivate( '_ensureSnapshotsFolder' )
-    def _ensureSnapshotsFolder( self, subdir=None ):
-
-        """ Ensure that the appropriate snapshot folder exists.
-        """
-        path = [ 'snapshots', self._snapshot_id ]
-
-        if subdir is not None:
-            path.extend( subdir.split( '/' ) )
-
-        current = self._tool
-
-        for element in path:
-
-            if element not in current.objectIds():
-                # No Unicode IDs!
-                current._setObject( str( element ), Folder( element ) )
-
-            current = current._getOb( element )
-
-        return current
-
-InitializeClass( SnapshotExportContext )
-
-
-class SnapshotImportContext( Implicit ):
-
-    __implements__ = ( IImportContext, )
-
-    security = ClassSecurityInfo()
-
-    def __init__( self
-                , tool
-                , snapshot_id
-                , should_purge=False
-                , encoding=None
-                ):
-
-        self._tool = tool = aq_inner( tool )
-        self._site = aq_parent( tool )
-        self._snapshot_id = snapshot_id
-        self._encoding = encoding
-        self._should_purge = bool( should_purge )
-
-    security.declareProtected( ManagePortal, 'getSite' )
-    def getSite( self ):
-
-        """ See ISetupContext.
-        """
-        return aq_self(self._site)
-
-    security.declareProtected( ManagePortal, 'getEncoding' )
-    def getEncoding( self ):
-
-        """ Return the encoding used in data files.
-
-        o Return None if the data should not be encoded.
-        """
-        return self._encoding
-
-    security.declareProtected( ManagePortal, 'readDataFile' )
-    def readDataFile( self, filename, subdir=None ):
-
-        """ See IImportContext.
-        """
-        try:
-            snapshot = self._getSnapshotFolder( subdir )
-            object = snapshot._getOb( filename )
-        except ( AttributeError, KeyError ):
-            return None
-
-        try:
-            return object.read()
-        except AttributeError:
-            return object.manage_FTPget()
-
-    security.declareProtected( ManagePortal, 'getLastModified' )
-    def getLastModified( self, path ):
-
-        """ See IImportContext.
-        """
-        try:
-            snapshot = self._getSnapshotFolder()
-            object = snapshot.restrictedTraverse( path )
-        except ( AttributeError, KeyError ):
-            return None
-        else:
-            return object.bobobase_modification_time()
-
-    security.declareProtected( ManagePortal, 'isDirectory' )
-    def isDirectory( self, path ):
-
-        """ See IImportContext.
-        """
-        try:
-            snapshot = self._getSnapshotFolder()
-            object = snapshot.restrictedTraverse( path )
-        except ( AttributeError, KeyError ):
-            return None
-        else:
-            folderish = getattr( object, 'isPrincipiaFolderish', False )
-            return bool( folderish )
-
-    security.declareProtected( ManagePortal, 'listDirectory' )
-    def listDirectory( self, path, skip=() ):
-
-        """ See IImportContext.
-        """
-        try:
-            snapshot = self._getSnapshotFolder()
-            subdir = snapshot.restrictedTraverse( path )
-        except ( AttributeError, KeyError ):
-            return None
-        else:
-            if not getattr( subdir, 'isPrincipiaFolderish', False ):
-                return None
-
-            object_ids = subdir.objectIds()
-            return [ x for x in object_ids if x not in skip ]
-
-    security.declareProtected( ManagePortal, 'shouldPurge' )
-    def shouldPurge( self ):
-
-        """ See IImportContext.
-        """
-        return self._should_purge
-
-    #
-    #   Helper methods
-    #
-    security.declarePrivate( '_getSnapshotFolder' )
-    def _getSnapshotFolder( self, subdir=None ):
-
-        """ Return the appropriate snapshot (sub)folder.
-        """
-        path = [ 'snapshots', self._snapshot_id ]
-
-        if subdir is not None:
-            path.extend( subdir.split( '/' ) )
-
-        return self._tool.restrictedTraverse( path )
-
-InitializeClass( SnapshotImportContext )
+# BBB
+from Products.GenericSetup.context import DirectoryImportContext
+from Products.GenericSetup.context import DirectoryExportContext
+from Products.GenericSetup.context import TarballExportContext
+from Products.GenericSetup.context import SnapshotExportContext
+from Products.GenericSetup.context import SnapshotImportContext

Modified: CMF/trunk/CMFSetup/differ.py
===================================================================
--- CMF/trunk/CMFSetup/differ.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFSetup/differ.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -15,215 +15,6 @@
 $Id$
 """
 
-from difflib import unified_diff
-import re
-
-from Globals import InitializeClass
-from AccessControl import ClassSecurityInfo
-
-BLANKS_REGEX = re.compile( r'^\s*$' )
-
-def unidiff( a
-           , b
-           , filename_a='original'
-           , timestamp_a=None
-           , filename_b='modified'
-           , timestamp_b=None
-           , ignore_blanks=False
-           ):
-    r"""Compare two sequences of lines; generate the resulting delta.
-
-    Each sequence must contain individual single-line strings
-    ending with newlines. Such sequences can be obtained from the
-    `readlines()` method of file-like objects.  The delta
-    generated also consists of newline-terminated strings, ready
-    to be printed as-is via the writeline() method of a file-like
-    object.
-
-    Note that the last line of a file may *not* have a newline;
-    this is reported in the same way that GNU diff reports this.
-    *This method only supports UNIX line ending conventions.*
-
-        filename_a and filename_b are used to generate the header,
-        allowing other tools to determine what 'files' were used
-        to generate this output.
-
-        timestamp_a and timestamp_b, when supplied, are expected
-        to be last-modified timestamps to be inserted in the
-        header, as floating point values since the epoch.
-
-    Example:
-
-    >>> print ''.join(UniDiffer().compare(
-    ...     'one\ntwo\nthree\n'.splitlines(1),
-    ...     'ore\ntree\nemu\n'.splitlines(1))),
-    +++ original
-    --- modified
-    @@ -1,3 +1,3 @@
-    -one
-    +ore
-    -two
-    -three
-    +tree
-    +emu
-    """
-    if isinstance( a, basestring ):
-        a = a.splitlines()
-
-    if isinstance( b, basestring ):
-        b = b.splitlines()
-
-    if ignore_blanks:
-        a = [ x for x in a if not BLANKS_REGEX.match( x ) ]
-        b = [ x for x in b if not BLANKS_REGEX.match( x ) ]
-
-    return unified_diff( a
-                       , b
-                       , filename_a
-                       , filename_b
-                       , timestamp_a
-                       , timestamp_b
-                       , lineterm=""
-                       )
-
-class ConfigDiff:
-
-    security = ClassSecurityInfo()
-
-    def __init__( self
-                , lhs
-                , rhs
-                , missing_as_empty=False
-                , ignore_blanks=False
-                , skip=('CVS','.svn')
-                ):
-        self._lhs = lhs
-        self._rhs = rhs
-        self._missing_as_empty = missing_as_empty
-        self._ignore_blanks=ignore_blanks
-        self._skip = skip
-
-    security.declarePrivate( 'compareDirectories' )
-    def compareDirectories( self, subdir=None ):
-
-        lhs_files = self._lhs.listDirectory( subdir, self._skip )
-        if lhs_files is None:
-            lhs_files = []
-
-        rhs_files = self._rhs.listDirectory( subdir, self._skip )
-        if rhs_files is None:
-            rhs_files = []
-
-        added = [ f for f in rhs_files if f not in lhs_files ]
-        removed = [ f for f in lhs_files if f not in rhs_files ]
-        all_files = lhs_files + added
-        all_files.sort()
-
-        result = []
-
-        for filename in all_files:
-
-            if subdir is None:
-                pathname = filename
-            else:
-                pathname = '%s/%s' % ( subdir, filename )
-
-            if filename not in added:
-                isDirectory = self._lhs.isDirectory( pathname )
-            else:
-                isDirectory = self._rhs.isDirectory( pathname )
-
-            if not self._missing_as_empty and filename in removed:
-
-                if isDirectory:
-                    result.append( '** Directory %s removed\n' % pathname )
-                    result.extend( self.compareDirectories( pathname ) )
-                else:
-                    result.append( '** File %s removed\n' % pathname )
-
-            elif not self._missing_as_empty and filename in added:
-
-                if isDirectory:
-                    result.append( '** Directory %s added\n' % pathname )
-                    result.extend( self.compareDirectories( pathname ) )
-                else:
-                    result.append( '** File %s added\n' % pathname )
-
-            elif isDirectory:
-
-                result.extend( self.compareDirectories( pathname ) )
-
-                if ( filename not in added + removed and
-                    not self._rhs.isDirectory( pathname ) ):
-
-                    result.append( '** Directory %s replaced with a file of '
-                                   'the same name\n' % pathname )
-
-                    if self._missing_as_empty:
-                        result.extend( self.compareFiles( filename, subdir ) )
-            else:
-                if ( filename not in added + removed and
-                     self._rhs.isDirectory( pathname ) ):
-
-                    result.append( '** File %s replaced with a directory of '
-                                   'the same name\n' % pathname )
-
-                    if self._missing_as_empty:
-                        result.extend( self.compareFiles( filename, subdir ) )
-
-                    result.extend( self.compareDirectories( pathname ) )
-                else:
-                    result.extend( self.compareFiles( filename, subdir ) )
-
-        return result
-
-    security.declarePrivate( 'compareFiles' )
-    def compareFiles( self, filename, subdir=None ):
-
-        if subdir is None:
-            path = filename
-        else:
-            path = '%s/%s' % ( subdir, filename )
-
-        lhs_file = self._lhs.readDataFile( filename, subdir )
-        lhs_time = self._lhs.getLastModified( path )
-
-        if lhs_file is None:
-            assert self._missing_as_empty
-            lhs_file = ''
-            lhs_time = 0
-
-        rhs_file = self._rhs.readDataFile( filename, subdir )
-        rhs_time = self._rhs.getLastModified( path )
-
-        if rhs_file is None:
-            assert self._missing_as_empty
-            rhs_file = ''
-            rhs_time = 0
-
-        if lhs_file == rhs_file:
-            diff_lines = []
-        else:
-            diff_lines = unidiff( lhs_file
-                                , rhs_file
-                                , filename_a=path
-                                , timestamp_a=lhs_time
-                                , filename_b=path
-                                , timestamp_b=rhs_time
-                                , ignore_blanks=self._ignore_blanks
-                                )
-            diff_lines = list( diff_lines ) # generator
-
-        if len( diff_lines ) == 0: # No *real* difference found
-            return []
-
-        diff_lines.insert( 0, 'Index: %s' % path )
-        diff_lines.insert( 1, '=' * 67 )
-
-        return diff_lines
-
-    security.declarePrivate( 'compare' )
-    def compare( self ):
-        return '\n'.join( self.compareDirectories() )
-
-InitializeClass( ConfigDiff )
+# BBB
+from Products.GenericSetup.context import unidiff
+from Products.GenericSetup.context import ConfigDiff

Modified: CMF/trunk/CMFSetup/interfaces.py
===================================================================
--- CMF/trunk/CMFSetup/interfaces.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFSetup/interfaces.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -15,494 +15,18 @@
 $Id$
 """
 
-from Interface import Interface
-
-
-BASE, EXTENSION = range(2)
-
-
-class IPseudoInterface( Interface ):
-
-    """ API documentation;  not testable / enforceable.
-    """
-
-class ISetupContext( Interface ):
-
-    """ Context used for export / import plugins.
-    """
-    def getSite():
-
-        """ Return the site object being configured / dumped.
-        """
-
-class IImportContext( ISetupContext ):
-
-    def getEncoding():
-
-        """ Get the encoding used for configuration data within the site.
-
-        o Return None if the data should not be encoded.
-        """
-
-    def readDataFile( filename, subdir=None ):
-
-        """ Search the current configuration for the requested file.
-
-        o 'filename' is the name (without path elements) of the file.
-
-        o 'subdir' is an optional subdirectory;  if not supplied, search
-          only the "root" directory.
-
-        o Return the file contents as a string, or None if the
-          file cannot be found.
-        """
-
-    def getLastModified( path ):
-
-        """ Return the modification timestamp of the item at 'path'.
-
-        o Result will be a DateTime instance.
-
-        o Search profiles in the configuration in order.
-
-        o If the context is filesystem based, return the 'stat' timestamp
-          of the file / directory to which 'path' points.
-
-        o If the context is ZODB-based, return the Zope modification time
-          of the object to which 'path' points.
-
-        o Return None if 'path' does not point to any object.
-        """
-
-    def isDirectory( path ):
-
-        """ Test whether path points to a directory / folder.
-
-        o If the context is filesystem based, check that 'path' points to
-          a subdirectory within the "root" directory.
-
-        o If the context is ZODB-based, check that 'path' points to a
-          "container" under the context's tool.
-
-        o Return None if 'path' does not resolve;  otherwise, return a
-          bool.
-        """
-
-    def listDirectory( path, skip=('CVS', '.svn') ):
-
-        """ List IDs of the contents of a  directory / folder.
-
-        o Omit names in 'skip'.
-
-        o If 'path' does not point to a directory / folder, return None.
-        """
-
-    def shouldPurge():
-
-        """ When installing, should the existing setup be purged?
-        """
-
-class IImportPlugin( IPseudoInterface ):
-
-    """ Signature for callables used to import portions of site configuration.
-    """
-    def __call__( context ):
-
-        """ Perform the setup step.
-
-        o Return a message describing the work done.
-
-        o 'context' must implement IImportContext.
-        """
-
-class IExportContext( ISetupContext ):
-
-    def writeDataFile( filename, text, content_type, subdir=None ):
-
-        """ Write data into the specified location.
-
-        o 'filename' is the unqualified name of the file.
-
-        o 'text' is the content of the file.
-
-        o 'content_type' is the MIMEtype of the file.
-
-        o 'subdir', if passed, is a path to a subdirectory / folder in
-          which to write the file;  if not passed, write the file to the
-          "root" of the target.
-        """
-
-class IExportPlugin( IPseudoInterface ):
-
-    """ Signature for callables used to export portions of site configuration.
-    """
-    def __call__( context ):
-
-        """ Write export data for the site wrapped by context.
-
-        o Return a message describing the work done.
-
-        o 'context' must implement IExportContext.  The plugin will use
-          its 'writeDataFile' method for each file to be exported.
-        """
-
-class IStepRegistry( Interface ):
-
-    """ Base interface for step registries.
-    """
-    def listSteps():
-
-        """ Return a sequence of IDs of registered steps.
-
-        o Order is not significant.
-        """
-
-    def listStepMetadata():
-
-        """ Return a sequence of mappings describing registered steps.
-
-        o Mappings will be ordered alphabetically.
-        """
-
-    def getStepMetadata( key, default=None ):
-
-        """ Return a mapping of metadata for the step identified by 'key'.
-
-        o Return 'default' if no such step is registered.
-
-        o The 'handler' metadata is available via 'getStep'.
-        """
-
-    def generateXML():
-
-        """ Return a round-trippable XML representation of the registry.
-
-        o 'handler' values are serialized using their dotted names.
-        """
-
-    def parseXML( text ):
-
-        """ Parse 'text'.
-        """
-
-class IImportStepRegistry( IStepRegistry ):
-
-    """ API for import step registry.
-    """
-    def sortSteps():
-
-        """ Return a sequence of registered step IDs
-
-        o Sequence is sorted topologically by dependency, with the dependent
-          steps *after* the steps they depend on.
-        """
-
-    def checkComplete():
-
-        """ Return a sequence of ( node, edge ) tuples for unsatisifed deps.
-        """
-
-    def getStep( key, default=None ):
-
-        """ Return the IImportPlugin registered for 'key'.
-
-        o Return 'default' if no such step is registered.
-        """
-
-    def registerStep( id
-                    , version
-                    , handler
-                    , dependencies=()
-                    , title=None
-                    , description=None
-                    ):
-        """ Register a setup step.
-
-        o 'id' is a unique name for this step,
-
-        o 'version' is a string for comparing versions, it is preferred to
-          be a yyyy/mm/dd-ii formatted string (date plus two-digit
-          ordinal).  when comparing two version strings, the version with
-          the lower sort order is considered the older version.
-
-          - Newer versions of a step supplant older ones.
-
-          - Attempting to register an older one after a newer one results
-            in a KeyError.
-
-        o 'handler' should implement IImportPlugin.
-
-        o 'dependencies' is a tuple of step ids which have to run before
-          this step in order to be able to run at all. Registration of
-          steps that have unmet dependencies are deferred until the
-          dependencies have been registered.
-
-        o 'title' is a one-line UI description for this step.
-          If None, the first line of the documentation string of the handler
-          is used, or the id if no docstring can be found.
-
-        o 'description' is a one-line UI description for this step.
-          If None, the remaining line of the documentation string of
-          the handler is used, or default to ''.
-        """
-
-class IExportStepRegistry( IStepRegistry ):
-
-    """ API for export step registry.
-    """
-    def getStep( key, default=None ):
-
-        """ Return the IExportPlugin registered for 'key'.
-
-        o Return 'default' if no such step is registered.
-        """
-
-    def registerStep( id, handler, title=None, description=None ):
-
-        """ Register an export step.
-
-        o 'id' is the unique identifier for this step
-
-        o 'handler' should implement IExportPlugin.
-
-        o 'title' is a one-line UI description for this step.
-          If None, the first line of the documentation string of the step
-          is used, or the id if no docstring can be found.
-
-        o 'description' is a one-line UI description for this step.
-          If None, the remaining line of the documentation string of
-          the step is used, or default to ''.
-        """
-
-class IToolsetRegistry( Interface ):
-
-    """ API for toolset registry.
-    """
-    def listForbiddenTools():
-
-        """ Return a list of IDs of tools which must be removed, if present.
-        """
-
-    def addForbiddenTool(tool_id ):
-
-        """ Add 'tool_id' to the list of forbidden tools.
-
-        o Raise KeyError if 'tool_id' is already in the list.
-
-        o Raise ValueError if 'tool_id' is in the "required" list.
-        """
-
-    def listRequiredTools():
-
-        """ Return a list of IDs of tools which must be present.
-        """
-
-    def getRequiredToolInfo( tool_id ):
-
-        """ Return a mapping describing a partiuclar required tool.
-
-        o Keys include:
-
-          'id' -- the ID of the tool
-
-          'class' -- a dotted path to its class
-
-        o Raise KeyError if 'tool_id' id not a known tool.
-        """
-
-    def listRequiredToolInfo():
-
-        """ Return a list of IDs of tools which must be present.
-        """
-
-    def addRequiredTool( tool_id, dotted_name ):
-
-        """ Add a tool to our "required" list.
-
-        o 'tool_id' is the tool's ID.
-
-        o 'dotted_name' is a dotted (importable) name of the tool's class.
-
-        o Raise KeyError if we have already registered a class for 'tool_id'.
-
-        o Raise ValueError if 'tool_id' is in the "forbidden" list.
-        """
-
-class IProfileRegistry( Interface ):
-
-    """ API for profile registry.
-    """
-    def getProfileInfo( profile_id ):
-
-        """ Return a mapping describing a registered filesystem profile.
-
-        o Keys include:
-
-          'id' -- the ID of the profile
-
-          'title' -- its title
-
-          'description' -- a textual description of the profile
-
-          'path' -- a path to the profile on the filesystem.
-
-          'product' -- the name of the product to which 'path' is
-             relative (None for absolute paths).
-
-          'type' -- either BASE or EXTENSION
-        """
-
-    def listProfiles():
-
-        """ Return a list of IDs for registered profiles.
-        """
-
-    def listProfileInfo():
-
-        """ Return a list of mappings describing registered profiles.
-
-        o See 'getProfileInfo' for a description of the mappings' keys.
-        """
-
-    def registerProfile( name
-                       , title
-                       , description
-                       , path
-                       , product=None
-                       , profile_type=BASE
-                       ):
-        """ Add a new profile to the registry.
-
-        o If an existing profile is already registered for 'product:name',
-          raise KeyError.
-
-        o If 'product' is passed, then 'path' should be interpreted as
-          relative to the corresponding product directory.
-        """
-
-class ISetupTool( Interface ):
-
-    """ API for SetupTool.
-    """
-
-    def getEncoding():
-
-        """ Get the encoding used for configuration data within the site.
-
-        o Return None if the data should not be encoded.
-        """
-
-    def getImportContextID():
-
-        """ Get the ID of the active import context.
-        """
-
-    def setImportContext( context_id ):
-
-        """ Set the ID of the active import context and update the registries.
-        """
-
-    def getImportStepRegistry():
-
-        """ Return the IImportStepRegistry for the tool.
-        """
-
-    def getExportStepRegistry():
-
-        """ Return the IExportStepRegistry for the tool.
-        """
-
-    def getToolsetRegistry():
-
-        """ Return the IToolsetRegistry for the tool.
-        """
-
-    def runImportStep( step_id, run_dependencies=True, purge_old=None ):
-
-        """ Execute a given setup step
-
-        o 'step_id' is the ID of the step to run.
-
-        o If 'purge_old' is True, then run the step after purging any
-          "old" setup first (this is the responsibility of the step,
-          which must check the context we supply).
-
-        o If 'run_dependencies' is True, then run any out-of-date
-          dependency steps first.
-
-        o Return a mapping, with keys:
-
-          'steps' -- a sequence of IDs of the steps run.
-
-          'messages' -- a dictionary holding messages returned from each
-            step
-        """
-
-    def runAllImportSteps( purge_old=None ):
-
-        """ Run all setup steps in dependency order.
-
-        o If 'purge_old' is True, then run each step after purging any
-          "old" setup first (this is the responsibility of the step,
-          which must check the context we supply).
-
-        o Return a mapping, with keys:
-
-          'steps' -- a sequence of IDs of the steps run.
-
-          'messages' -- a dictionary holding messages returned from each
-            step
-        """
-
-    def runExportStep( step_id ):
-
-        """ Generate a tarball containing artifacts from one export step.
-
-        o 'step_id' identifies the export step.
-
-        o Return a mapping, with keys:
-
-          'steps' -- a sequence of IDs of the steps run.
-
-          'messages' -- a dictionary holding messages returned from each
-            step
-
-          'tarball' -- the stringified tar-gz data.
-        """
-
-    def runAllExportSteps():
-
-        """ Generate a tarball containing artifacts from all export steps.
-
-        o Return a mapping, with keys:
-
-          'steps' -- a sequence of IDs of the steps run.
-
-          'messages' -- a dictionary holding messages returned from each
-            step
-
-          'tarball' -- the stringified tar-gz data.
-        """
-
-    def createSnapshot( snapshot_id ):
-
-        """ Create a snapshot folder using all steps.
-
-        o 'snapshot_id' is the ID of the new folder.
-        """
-
-    def compareConfigurations( lhs_context
-                             , rhs_context
-                             , missing_as_empty=False
-                             , ignore_whitespace=False
-                             ):
-        """ Compare two configurations.
-
-        o 'lhs_context' and 'rhs_context' must implement IImportContext.
-
-        o If 'missing_as_empty', then compare files not present as though
-          they were zero-length;  otherwise, omit such files.
-
-        o If 'ignore_whitespace', then suppress diffs due only to whitespace
-          (c.f:  'diff -wbB')
-        """
+# BBB
+from Products.GenericSetup.interfaces import BASE
+from Products.GenericSetup.interfaces import EXTENSION
+from Products.GenericSetup.interfaces import IPseudoInterface
+from Products.GenericSetup.interfaces import ISetupContext
+from Products.GenericSetup.interfaces import IImportContext
+from Products.GenericSetup.interfaces import IImportPlugin
+from Products.GenericSetup.interfaces import IExportContext
+from Products.GenericSetup.interfaces import IExportPlugin
+from Products.GenericSetup.interfaces import IStepRegistry
+from Products.GenericSetup.interfaces import IImportStepRegistry
+from Products.GenericSetup.interfaces import IExportStepRegistry
+from Products.GenericSetup.interfaces import IToolsetRegistry
+from Products.GenericSetup.interfaces import IProfileRegistry
+from Products.GenericSetup.interfaces import ISetupTool

Modified: CMF/trunk/CMFSetup/registry.py
===================================================================
--- CMF/trunk/CMFSetup/registry.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFSetup/registry.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -15,739 +15,9 @@
 $Id$
 """
 
-from xml.sax import parseString
-
-from AccessControl import ClassSecurityInfo
-from Acquisition import Implicit
-from Globals import InitializeClass
-from Products.PageTemplates.PageTemplateFile import PageTemplateFile
-
-from interfaces import BASE
-from interfaces import IImportStepRegistry
-from interfaces import IExportStepRegistry
-from interfaces import IToolsetRegistry
-from interfaces import IProfileRegistry
-from permissions import ManagePortal
-from utils import HandlerBase
-from utils import _xmldir
-from utils import _getDottedName
-from utils import _resolveDottedName
-from utils import _extractDocstring
-
-
-class ImportStepRegistry( Implicit ):
-
-    """ Manage knowledge about steps to create / configure site.
-
-    o Steps are composed together to define a site profile.
-    """
-    __implements__ = ( IImportStepRegistry, )
-
-    security = ClassSecurityInfo()
-
-    def __init__( self ):
-
-        self.clear()
-
-    security.declareProtected( ManagePortal, 'listSteps' )
-    def listSteps( self ):
-
-        """ Return a sequence of IDs of registered steps.
-
-        o Order is not significant.
-        """
-        return self._registered.keys()
-
-    security.declareProtected( ManagePortal, 'sortSteps' )
-    def sortSteps( self ):
-
-        """ Return a sequence of registered step IDs
-
-        o Sequence is sorted topologically by dependency, with the dependent
-          steps *after* the steps they depend on.
-        """
-        return self._computeTopologicalSort()
-
-    security.declareProtected( ManagePortal, 'checkComplete' )
-    def checkComplete( self ):
-
-        """ Return a sequence of ( node, edge ) tuples for unsatisifed deps.
-        """
-        result = []
-        seen = {}
-
-        graph = self._computeTopologicalSort()
-
-        for node in graph:
-
-            dependencies = self.getStepMetadata( node )[ 'dependencies' ]
-
-            for dependency in dependencies:
-
-                if seen.get( dependency ) is None:
-                    result.append( ( node, dependency ) )
-
-            seen[ node ] = 1
-
-        return result
-
-    security.declareProtected( ManagePortal, 'getStepMetadata' )
-    def getStepMetadata( self, key, default=None ):
-
-        """ Return a mapping of metadata for the step identified by 'key'.
-
-        o Return 'default' if no such step is registered.
-
-        o The 'handler' metadata is available via 'getStep'.
-        """
-        result = {}
-
-        info = self._registered.get( key )
-
-        if info is None:
-            return default
-
-        return info.copy()
-
-    security.declareProtected( ManagePortal, 'listStepMetadata' )
-    def listStepMetadata( self ):
-
-        """ Return a sequence of mappings describing registered steps.
-
-        o Mappings will be ordered alphabetically.
-        """
-        step_ids = self.listSteps()
-        step_ids.sort()
-        return [ self.getStepMetadata( x ) for x in step_ids ]
-
-    security.declareProtected( ManagePortal, 'generateXML' )
-    def generateXML( self ):
-
-        """ Return a round-trippable XML representation of the registry.
-
-        o 'handler' values are serialized using their dotted names.
-        """
-        return self._exportTemplate()
-
-    security.declarePrivate( 'getStep' )
-    def getStep( self, key, default=None ):
-
-        """ Return the IImportPlugin registered for 'key'.
-
-        o Return 'default' if no such step is registered.
-        """
-        marker = object()
-        info = self._registered.get( key, marker )
-
-        if info is marker:
-            return default
-
-        return _resolveDottedName( info[ 'handler' ] )
-
-    security.declarePrivate( 'registerStep' )
-    def registerStep( self
-                    , id
-                    , version
-                    , handler
-                    , dependencies=()
-                    , title=None
-                    , description=None
-                    ):
-        """ Register a setup step.
-
-        o 'id' is a unique name for this step,
-
-        o 'version' is a string for comparing versions, it is preferred to
-          be a yyyy/mm/dd-ii formatted string (date plus two-digit
-          ordinal).  when comparing two version strings, the version with
-          the lower sort order is considered the older version.
-
-          - Newer versions of a step supplant older ones.
-
-          - Attempting to register an older one after a newer one results
-            in a KeyError.
-
-        o 'handler' should implement IImportPlugin.
-
-        o 'dependencies' is a tuple of step ids which have to run before
-          this step in order to be able to run at all. Registration of
-          steps that have unmet dependencies are deferred until the
-          dependencies have been registered.
-
-        o 'title' is a one-line UI description for this step.
-          If None, the first line of the documentation string of the handler
-          is used, or the id if no docstring can be found.
-
-        o 'description' is a one-line UI description for this step.
-          If None, the remaining line of the documentation string of
-          the handler is used, or default to ''.
-        """
-        already = self.getStepMetadata( id )
-
-        if already and already[ 'version' ] > version:
-            raise KeyError( 'Existing registration for step %s, version %s'
-                          % ( id, already[ 'version' ] ) )
-
-        if title is None or description is None:
-
-            t, d = _extractDocstring( handler, id, '' )
-
-            title = title or t
-            description = description or d
-
-        info = { 'id'           : id
-               , 'version'      : version
-               , 'handler'      : _getDottedName( handler )
-               , 'dependencies' : dependencies
-               , 'title'        : title
-               , 'description'  : description
-               }
-
-        self._registered[ id ] = info
-
-    security.declarePrivate( 'parseXML' )
-    def parseXML( self, text, encoding=None ):
-
-        """ Parse 'text'.
-        """
-        reader = getattr( text, 'read', None )
-
-        if reader is not None:
-            text = reader()
-
-        parser = _ImportStepRegistryParser( encoding )
-        parseString( text, parser )
-
-        return parser._parsed
-
-    security.declarePrivate( 'clear' )
-    def clear( self ):
-
-        self._registered = {}
-
-    #
-    #   Helper methods
-    #
-    security.declarePrivate( '_computeTopologicalSort' )
-    def _computeTopologicalSort( self ):
-
-        result = []
-
-        graph = [ ( x[ 'id' ], x[ 'dependencies' ] )
-                    for x in self._registered.values() ]
-
-        for node, edges in graph:
-
-            after = -1
-
-            for edge in edges:
-
-                if edge in result:
-                    after = max( after, result.index( edge ) )
-
-            result.insert( after + 1, node )
-
-        return result
-
-    security.declarePrivate( '_exportTemplate' )
-    _exportTemplate = PageTemplateFile( 'isrExport.xml', _xmldir )
-
-InitializeClass( ImportStepRegistry )
-
-
-class ExportStepRegistry( Implicit ):
-
-    """ Registry of known site-configuration export steps.
-
-    o Each step is registered with a unique id.
-
-    o When called, with the portal object passed in as an argument,
-      the step must return a sequence of three-tuples,
-      ( 'data', 'content_type', 'filename' ), one for each file exported
-      by the step.
-
-      - 'data' is a string containing the file data;
-
-      - 'content_type' is the MIME type of the data;
-
-      - 'filename' is a suggested filename for use when downloading.
-
-    """
-    __implements__ = ( IExportStepRegistry, )
-
-    security = ClassSecurityInfo()
-
-    def __init__( self ):
-
-        self.clear()
-
-    security.declareProtected( ManagePortal, 'listSteps' )
-    def listSteps( self ):
-
-        """ Return a list of registered step IDs.
-        """
-        return self._registered.keys()
-
-    security.declareProtected( ManagePortal, 'getStepMetadata' )
-    def getStepMetadata( self, key, default=None ):
-
-        """ Return a mapping of metadata for the step identified by 'key'.
-
-        o Return 'default' if no such step is registered.
-
-        o The 'handler' metadata is available via 'getStep'.
-        """
-        info = self._registered.get( key )
-
-        if info is None:
-            return default
-
-        return info.copy()
-
-    security.declareProtected( ManagePortal, 'listStepMetadata' )
-    def listStepMetadata( self ):
-
-        """ Return a sequence of mappings describing registered steps.
-
-        o Steps will be alphabetical by ID.
-        """
-        step_ids = self.listSteps()
-        step_ids.sort()
-        return [ self.getStepMetadata( x ) for x in step_ids ]
-
-    security.declareProtected( ManagePortal, 'generateXML' )
-    def generateXML( self ):
-
-        """ Return a round-trippable XML representation of the registry.
-
-        o 'handler' values are serialized using their dotted names.
-        """
-        return self._exportTemplate()
-
-    security.declarePrivate( 'getStep' )
-    def getStep( self, key, default=None ):
-
-        """ Return the IExportPlugin registered for 'key'.
-
-        o Return 'default' if no such step is registered.
-        """
-        marker = object()
-        info = self._registered.get( key, marker )
-
-        if info is marker:
-            return default
-
-        return _resolveDottedName( info[ 'handler' ] )
-
-    security.declarePrivate( 'registerStep' )
-    def registerStep( self, id, handler, title=None, description=None ):
-
-        """ Register an export step.
-
-        o 'id' is the unique identifier for this step
-
-        o 'step' should implement IExportPlugin.
-
-        o 'title' is a one-line UI description for this step.
-          If None, the first line of the documentation string of the step
-          is used, or the id if no docstring can be found.
-
-        o 'description' is a one-line UI description for this step.
-          If None, the remaining line of the documentation string of
-          the step is used, or default to ''.
-        """
-        if title is None or description is None:
-
-            t, d = _extractDocstring( handler, id, '' )
-
-            title = title or t
-            description = description or d
-
-        info = { 'id'           : id
-               , 'handler'      : _getDottedName( handler )
-               , 'title'        : title
-               , 'description'  : description
-               }
-
-        self._registered[ id ] = info
-
-    security.declarePrivate( 'parseXML' )
-    def parseXML( self, text, encoding=None ):
-
-        """ Parse 'text'.
-        """
-        reader = getattr( text, 'read', None )
-
-        if reader is not None:
-            text = reader()
-
-        parser = _ExportStepRegistryParser( encoding )
-        parseString( text, parser )
-
-        return parser._parsed
-
-    security.declarePrivate( 'clear' )
-    def clear( self ):
-
-        self._registered = {}
-
-    #
-    #   Helper methods
-    #
-    security.declarePrivate( '_exportTemplate' )
-    _exportTemplate = PageTemplateFile( 'esrExport.xml', _xmldir )
-
-InitializeClass( ExportStepRegistry )
-
-class ToolsetRegistry( Implicit ):
-
-    """ Track required / forbidden tools.
-    """
-    __implements__ = ( IToolsetRegistry, )
-
-    security = ClassSecurityInfo()
-    security.setDefaultAccess( 'allow' )
-
-    def __init__( self ):
-
-        self.clear()
-
-    #
-    #   Toolset API
-    #
-    security.declareProtected( ManagePortal, 'listForbiddenTools' )
-    def listForbiddenTools( self ):
-
-        """ See IToolsetRegistry.
-        """
-        result = list( self._forbidden )
-        result.sort()
-        return result
-
-    security.declareProtected( ManagePortal, 'addForbiddenTool' )
-    def addForbiddenTool( self, tool_id ):
-
-        """ See IToolsetRegistry.
-        """
-        if tool_id in self._forbidden:
-            return
-
-        if self._required.get( tool_id ) is not None:
-            raise ValueError, 'Tool %s is required!' % tool_id
-
-        self._forbidden.append( tool_id )
-
-    security.declareProtected( ManagePortal, 'listRequiredTools' )
-    def listRequiredTools( self ):
-
-        """ See IToolsetRegistry.
-        """
-        result = list( self._required.keys() )
-        result.sort()
-        return result
-
-    security.declareProtected( ManagePortal, 'getRequiredToolInfo' )
-    def getRequiredToolInfo( self, tool_id ):
-
-        """ See IToolsetRegistry.
-        """
-        return self._required[ tool_id ]
-
-    security.declareProtected( ManagePortal, 'listRequiredToolInfo' )
-    def listRequiredToolInfo( self ):
-
-        """ See IToolsetRegistry.
-        """
-        return [ self.getRequiredToolInfo( x )
-                        for x in self.listRequiredTools() ]
-
-    security.declareProtected( ManagePortal, 'addRequiredTool' )
-    def addRequiredTool( self, tool_id, dotted_name ):
-
-        """ See IToolsetRegistry.
-        """
-        if tool_id in self._forbidden:
-            raise ValueError, "Forbidden tool ID: %s" % tool_id
-
-        self._required[ tool_id ] = { 'id' : tool_id
-                                    , 'class' : dotted_name
-                                    }
-
-    security.declareProtected( ManagePortal, 'generateXML' )
-    def generateXML( self ):
-
-        """ Pseudo API.
-        """
-        return self._toolsetConfig()
-
-    security.declareProtected( ManagePortal, 'parseXML' )
-    def parseXML( self, text, encoding=None ):
-
-        """ Pseudo-API
-        """
-        reader = getattr( text, 'read', None )
-
-        if reader is not None:
-            text = reader()
-
-        parser = _ToolsetParser( encoding )
-        parseString( text, parser )
-
-        for tool_id in parser._forbidden:
-            self.addForbiddenTool( tool_id )
-
-        for tool_id, dotted_name in parser._required.items():
-            self.addRequiredTool( tool_id, dotted_name )
-
-    security.declarePrivate( 'clear' )
-    def clear( self ):
-
-        self._forbidden = []
-        self._required = {}
-
-    #
-    #   Helper methods.
-    #
-    security.declarePrivate( '_toolsetConfig' )
-    _toolsetConfig = PageTemplateFile( 'tscExport.xml'
-                                     , _xmldir
-                                     , __name__='toolsetConfig'
-                                     )
-
-InitializeClass( ToolsetRegistry )
-
-class ProfileRegistry( Implicit ):
-
-    """ Track registered profiles.
-    """
-    __implements__ = ( IProfileRegistry, )
-
-    security = ClassSecurityInfo()
-    security.setDefaultAccess( 'allow' )
-
-    def __init__( self ):
-
-        self.clear()
-
-    security.declareProtected( ManagePortal, '' )
-    def getProfileInfo( self, profile_id ):
-
-        """ See IProfileRegistry.
-        """
-        result = self._profile_info[ profile_id ]
-        return result.copy()
-
-    security.declareProtected( ManagePortal, 'listProfiles' )
-    def listProfiles( self ):
-
-        """ See IProfileRegistry.
-        """
-        return tuple( self._profile_ids )
-
-    security.declareProtected( ManagePortal, 'listProfileInfo' )
-    def listProfileInfo( self ):
-
-        """ See IProfileRegistry.
-        """
-        return [ self.getProfileInfo( id ) for id in self.listProfiles() ]
-
-    security.declareProtected( ManagePortal, 'registerProfile' )
-    def registerProfile( self
-                       , name
-                       , title
-                       , description
-                       , path
-                       , product=None
-                       , profile_type=BASE
-                       ):
-        """ See IProfileRegistry.
-        """
-        profile_id = '%s:%s' % (product or 'other', name)
-        if self._profile_info.get( profile_id ) is not None:
-            raise KeyError, 'Duplicate profile ID: %s' % profile_id
-
-        self._profile_ids.append( profile_id )
-
-        info = { 'id' : profile_id
-               , 'title' : title
-               , 'description' : description
-               , 'path' : path
-               , 'product' : product
-               , 'type': profile_type
-               }
-
-        self._profile_info[ profile_id ] = info
-
-    security.declarePrivate( 'clear' )
-    def clear( self ):
-
-        self._profile_info = {}
-        self._profile_ids = []
-
-InitializeClass( ProfileRegistry )
-
-_profile_registry = ProfileRegistry()
-
-class _ImportStepRegistryParser( HandlerBase ):
-
-    security = ClassSecurityInfo()
-    security.declareObjectPrivate()
-    security.setDefaultAccess( 'deny' )
-
-    def __init__( self, encoding ):
-
-        self._encoding = encoding
-        self._started = False
-        self._pending = None
-        self._parsed = []
-
-    def startElement( self, name, attrs ):
-
-        if name == 'import-steps':
-
-            if self._started:
-                raise ValueError, 'Duplicated setup-steps element: %s' % name
-
-            self._started = True
-
-        elif name == 'import-step':
-
-            if self._pending is not None:
-                raise ValueError, 'Cannot nest setup-step elements'
-
-            self._pending = dict( [ ( k, self._extract( attrs, k ) )
-                                    for k in attrs.keys() ] )
-
-            self._pending[ 'dependencies' ] = []
-
-        elif name == 'dependency':
-
-            if not self._pending:
-                raise ValueError, 'Dependency outside of step'
-
-            depended = self._extract( attrs, 'step' )
-            self._pending[ 'dependencies' ].append( depended )
-
-        else:
-            raise ValueError, 'Unknown element %s' % name
-
-    def characters( self, content ):
-
-        if self._pending is not None:
-            content = self._encode( content )
-            self._pending.setdefault( 'description', [] ).append( content )
-
-    def endElement(self, name):
-
-        if name == 'import-steps':
-            pass
-
-        elif name == 'import-step':
-
-            if self._pending is None:
-                raise ValueError, 'No pending step!'
-
-            deps = tuple( self._pending[ 'dependencies' ] )
-            self._pending[ 'dependencies' ] = deps
-
-            desc = ''.join( self._pending[ 'description' ] )
-            self._pending[ 'description' ] = desc
-
-            self._parsed.append( self._pending )
-            self._pending = None
-
-InitializeClass( _ImportStepRegistryParser )
-
-class _ExportStepRegistryParser( HandlerBase ):
-
-    security = ClassSecurityInfo()
-    security.declareObjectPrivate()
-    security.setDefaultAccess( 'deny' )
-
-    def __init__( self, encoding ):
-
-        self._encoding = encoding
-        self._started = False
-        self._pending = None
-        self._parsed = []
-
-    def startElement( self, name, attrs ):
-
-        if name == 'export-steps':
-
-            if self._started:
-                raise ValueError, 'Duplicated export-steps element: %s' % name
-
-            self._started = True
-
-        elif name == 'export-step':
-
-            if self._pending is not None:
-                raise ValueError, 'Cannot nest export-step elements'
-
-            self._pending = dict( [ ( k, self._extract( attrs, k ) )
-                                    for k in attrs.keys() ] )
-
-        else:
-            raise ValueError, 'Unknown element %s' % name
-
-    def characters( self, content ):
-
-        if self._pending is not None:
-            content = self._encode( content )
-            self._pending.setdefault( 'description', [] ).append( content )
-
-    def endElement(self, name):
-
-        if name == 'export-steps':
-            pass
-
-        elif name == 'export-step':
-
-            if self._pending is None:
-                raise ValueError, 'No pending step!'
-
-            desc = ''.join( self._pending[ 'description' ] )
-            self._pending[ 'description' ] = desc
-
-            self._parsed.append( self._pending )
-            self._pending = None
-
-InitializeClass( _ExportStepRegistryParser )
-
-
-class _ToolsetParser( HandlerBase ):
-
-    security = ClassSecurityInfo()
-    security.declareObjectPrivate()
-    security.setDefaultAccess( 'deny' )
-
-    def __init__( self, encoding ):
-
-        self._encoding = encoding
-        self._required = {}
-        self._forbidden = []
-
-    def startElement( self, name, attrs ):
-
-        if name == 'tool-setup':
-            pass
-
-        elif name == 'forbidden':
-
-            tool_id = self._extract( attrs, 'tool_id' )
-
-            if tool_id not in self._forbidden:
-                self._forbidden.append( tool_id )
-
-        elif name == 'required':
-
-            tool_id = self._extract( attrs, 'tool_id' )
-            dotted_name = self._extract( attrs, 'class' )
-            self._required[ tool_id ] = dotted_name
-
-        else:
-            raise ValueError, 'Unknown element %s' % name
-
-
-InitializeClass( _ToolsetParser )
+# BBB
+from Products.GenericSetup.registry import ImportStepRegistry
+from Products.GenericSetup.registry import ExportStepRegistry
+from Products.GenericSetup.registry import ToolsetRegistry
+from Products.GenericSetup.registry import ProfileRegistry
+from Products.GenericSetup.registry import _profile_registry

Modified: CMF/trunk/CMFSetup/rolemap.py
===================================================================
--- CMF/trunk/CMFSetup/rolemap.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFSetup/rolemap.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -15,198 +15,6 @@
 $Id$
 """
 
-from AccessControl import ClassSecurityInfo
-from AccessControl.Permission import Permission
-from Globals import InitializeClass
-from Products.PageTemplates.PageTemplateFile import PageTemplateFile
-
-from permissions import ManagePortal
-from utils import _xmldir
-from utils import ConfiguratorBase
-from utils import CONVERTER, DEFAULT, KEY
-
-
-#
-#   Configurator entry points
-#
-_FILENAME = 'rolemap.xml'
-
-def importRolemap( context ):
-
-    """ Import roles / permission map from an XML file.
-
-    o 'context' must implement IImportContext.
-
-    o Register via Python:
-
-      registry = site.portal_setup.setup_steps
-      registry.registerStep( 'importRolemap'
-                           , '20040518-01'
-                           , Products.CMFSetup.rolemap.importRolemap
-                           , ()
-                           , 'Role / Permission import'
-                           , 'Import additional roles, and map '
-                           'roles to permissions'
-                           )
-
-    o Register via XML:
-
-      <setup-step id="importRolemap"
-                  version="20040518-01"
-                  handler="Products.CMFSetup.rolemap.importRolemap"
-                  title="Role / Permission import"
-      >Import additional roles, and map roles to permissions.</setup-step>
-
-    """
-    site = context.getSite()
-    encoding = context.getEncoding()
-
-    if context.shouldPurge():
-
-        items = site.__dict__.items()
-
-        for k, v in items: # XXX: WAAA
-
-            if k == '__ac_roles__':
-                delattr( site, k )
-
-            if k.startswith( '_' ) and k.endswith( '_Permission' ):
-                delattr( site, k )
-
-    text = context.readDataFile( _FILENAME )
-
-    if text is not None:
-
-        rc = RolemapConfigurator( site, encoding )
-        rolemap_info = rc.parseXML( text )
-
-        immediate_roles = list( getattr( site, '__ac_roles__', [] ) )[:]
-        already = {}
-
-        for role in site.valid_roles():
-            already[ role ] = 1
-
-        for role in rolemap_info[ 'roles' ]:
-
-            if already.get( role ) is None:
-                immediate_roles.append( role )
-                already[ role ] = 1
-
-        immediate_roles.sort()
-        site.__ac_roles__ = tuple( immediate_roles )
-
-        for permission in rolemap_info[ 'permissions' ]:
-
-            site.manage_permission( permission[ 'name' ]
-                                  , permission[ 'roles' ]
-                                  , permission[ 'acquire' ]
-                                  )
-
-    return 'Role / permission map imported.'
-
-
-def exportRolemap( context ):
-
-    """ Export roles / permission map as an XML file
-
-    o 'context' must implement IExportContext.
-
-    o Register via Python:
-
-      registry = site.portal_setup.export_steps
-      registry.registerStep( 'exportRolemap'
-                           , Products.CMFSetup.rolemap.exportRolemap
-                           , 'Role / Permission export'
-                           , 'Export additional roles, and '
-                             'role / permission map '
-                           )
-
-    o Register via XML:
-
-      <export-script id="exportRolemap"
-                     version="20040518-01"
-                     handler="Products.CMFSetup.rolemap.exportRolemap"
-                     title="Role / Permission export"
-      >Export additional roles, and role / permission map.</export-script>
-
-    """
-    site = context.getSite()
-    rc = RolemapConfigurator( site ).__of__( site )
-    text = rc.generateXML()
-
-    context.writeDataFile( _FILENAME, text, 'text/xml' )
-
-    return 'Role / permission map exported.'
-
-
-class RolemapConfigurator(ConfiguratorBase):
-    """ Synthesize XML description of sitewide role-permission settings.
-    """
-    security = ClassSecurityInfo()
-
-    security.declareProtected( ManagePortal, 'listRoles' )
-    def listRoles( self ):
-
-        """ List the valid role IDs for our site.
-        """
-        return self._site.valid_roles()
-
-    security.declareProtected( ManagePortal, 'listPermissions' )
-    def listPermissions( self ):
-
-        """ List permissions for export.
-
-        o Returns a sqeuence of mappings describing locally-modified
-          permission / role settings.  Keys include:
-
-          'permission' -- the name of the permission
-
-          'acquire' -- a flag indicating whether to acquire roles from the
-              site's container
-
-          'roles' -- the list of roles which have the permission.
-
-        o Do not include permissions which both acquire and which define
-          no local changes to the acquired policy.
-        """
-        permissions = []
-        valid_roles = self.listRoles()
-
-        for perm in self._site.ac_inherited_permissions( 1 ):
-
-            name = perm[ 0 ]
-            p = Permission( name, perm[ 1 ], self._site )
-            roles = p.getRoles( default=[] )
-            acquire = isinstance( roles, list )  # tuple means don't acquire
-            roles = [ r for r in roles if r in valid_roles ]
-
-            if roles or not acquire:
-                permissions.append( { 'name'    : name
-                                    , 'acquire' : acquire
-                                    , 'roles'   : roles
-                                    } )
-
-        return permissions
-
-    def _getExportTemplate(self):
-
-        return PageTemplateFile('rmeExport.xml', _xmldir)
-
-    def _getImportMapping(self):
-
-        return {
-          'rolemap':
-            { 'roles':       {CONVERTER: self._convertToUnique},
-              'permissions': {CONVERTER: self._convertToUnique} },
-          'roles':
-            { 'role':        {KEY: None} },
-          'role':
-            { 'name':        {KEY: None} },
-          'permissions':
-            { 'permission':  {KEY: None, DEFAULT: ()} },
-          'permission':
-            { 'name':        {},
-              'role':        {KEY: 'roles'},
-              'acquire':     {CONVERTER: self._convertToBoolean} } }
-
-InitializeClass(RolemapConfigurator)
+# BBB
+from Products.GenericSetup.rolemap import importRolemap
+from Products.GenericSetup.rolemap import exportRolemap

Deleted: CMF/trunk/CMFSetup/tests/conformance.py
===================================================================
--- CMF/trunk/CMFSetup/tests/conformance.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFSetup/tests/conformance.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -1,100 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004 Zope Corporation and Contributors. All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-""" Base classes for testing interface conformance.
-
-Derived testcase classes should define '_getTargetClass()', which must
-return the class being tested for conformance.
-
-$Id$
-"""
-
-class ConformsToISetupContext:
-
-    def test_ISetupContext_conformance( self ):
-
-        from Products.CMFSetup.interfaces import ISetupContext
-        from Interface.Verify import verifyClass
-
-        verifyClass( ISetupContext, self._getTargetClass() )
-
-class ConformsToIImportContext:
-
-    def test_IImportContext_conformance( self ):
-
-        from Products.CMFSetup.interfaces import IImportContext
-        from Interface.Verify import verifyClass
-
-        verifyClass( IImportContext, self._getTargetClass() )
-
-class ConformsToIExportContext:
-
-    def test_IExportContext_conformance( self ):
-
-        from Products.CMFSetup.interfaces import IExportContext
-        from Interface.Verify import verifyClass
-
-        verifyClass( IExportContext, self._getTargetClass() )
-
-class ConformsToIStepRegistry:
-
-    def test_IStepRegistry_conformance( self ):
-
-        from Products.CMFSetup.interfaces import IStepRegistry
-        from Interface.Verify import verifyClass
-
-        verifyClass( IStepRegistry, self._getTargetClass() )
-
-class ConformsToIImportStepRegistry:
-
-    def test_IImportStepRegistry_conformance( self ):
-
-        from Products.CMFSetup.interfaces import IImportStepRegistry
-        from Interface.Verify import verifyClass
-
-        verifyClass( IImportStepRegistry, self._getTargetClass() )
-
-class ConformsToIExportStepRegistry:
-
-    def test_IExportStepRegistry_conformance( self ):
-
-        from Products.CMFSetup.interfaces import IExportStepRegistry
-        from Interface.Verify import verifyClass
-
-        verifyClass( IExportStepRegistry, self._getTargetClass() )
-
-class ConformsToIToolsetRegistry:
-
-    def test_IToolsetRegistry_conformance( self ):
-
-        from Products.CMFSetup.interfaces import IToolsetRegistry
-        from Interface.Verify import verifyClass
-
-        verifyClass( IToolsetRegistry, self._getTargetClass() )
-
-class ConformsToIProfileRegistry:
-
-    def test_IProfileRegistry_conformance( self ):
-
-        from Products.CMFSetup.interfaces import IProfileRegistry
-        from Interface.Verify import verifyClass
-
-        verifyClass( IProfileRegistry, self._getTargetClass() )
-
-class ConformsToISetupTool:
-
-    def test_ISetupTool_conformance( self ):
-
-        from Products.CMFSetup.interfaces import ISetupTool
-        from Interface.Verify import verifyClass
-
-        verifyClass( ISetupTool, self._getTargetClass() )

Deleted: CMF/trunk/CMFSetup/tests/test_context.py
===================================================================
--- CMF/trunk/CMFSetup/tests/test_context.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFSetup/tests/test_context.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -1,988 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004 Zope Corporation and Contributors. All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-""" Unit tests for import / export contexts.
-
-$Id$
-"""
-
-import unittest
-import Testing
-import Zope2
-Zope2.startup()
-
-import os
-import time
-from StringIO import StringIO
-
-from DateTime.DateTime import DateTime
-from OFS.Folder import Folder
-from OFS.Image import File
-
-from Products.CMFCore.tests.base.testcase import SecurityRequestTest
-
-from common import FilesystemTestBase
-from common import TarballTester
-from common import _makeTestFile
-from conformance import ConformsToISetupContext
-from conformance import ConformsToIImportContext
-from conformance import ConformsToIExportContext
-
-
-class DummySite( Folder ):
-
-    pass
-
-class DummyTool( Folder ):
-
-    pass
-
-class DirectoryImportContextTests( FilesystemTestBase
-                                 , ConformsToISetupContext
-                                 , ConformsToIImportContext
-                                 ):
-
-    _PROFILE_PATH = '/tmp/ICTTexts'
-
-    def _getTargetClass( self ):
-
-        from Products.CMFSetup.context import DirectoryImportContext
-        return DirectoryImportContext
-
-    def test_readDataFile_nonesuch( self ):
-
-        FILENAME = 'nonesuch.txt'
-
-        site = DummySite( 'site' ).__of__( self.root )
-        ctx = self._makeOne( site, self._PROFILE_PATH )
-
-        self.assertEqual( ctx.readDataFile( FILENAME ), None )
-
-    def test_readDataFile_simple( self ):
-
-        from string import printable
-
-        FILENAME = 'simple.txt'
-        self._makeFile( FILENAME, printable )
-
-        site = DummySite( 'site' ).__of__( self.root )
-        ctx = self._makeOne( site, self._PROFILE_PATH )
-
-        self.assertEqual( ctx.readDataFile( FILENAME ), printable )
-
-    def test_readDataFile_subdir( self ):
-
-        from string import printable
-
-        FILENAME = 'subdir/nested.txt'
-        self._makeFile( FILENAME, printable )
-
-        site = DummySite( 'site' ).__of__( self.root )
-        ctx = self._makeOne( site, self._PROFILE_PATH )
-
-        self.assertEqual( ctx.readDataFile( FILENAME ), printable )
-
-    def test_getLastModified_nonesuch( self ):
-
-        FILENAME = 'nonesuch.txt'
-
-        site = DummySite( 'site' ).__of__( self.root )
-        ctx = self._makeOne( site, self._PROFILE_PATH )
-
-        self.assertEqual( ctx.getLastModified( FILENAME ), None )
-
-    def test_getLastModified_simple( self ):
-
-        from string import printable
-
-        FILENAME = 'simple.txt'
-        fqpath = self._makeFile( FILENAME, printable )
-        timestamp = os.path.getmtime( fqpath )
-
-        site = DummySite( 'site' ).__of__( self.root )
-        ctx = self._makeOne( site, self._PROFILE_PATH )
-
-        lm = ctx.getLastModified( FILENAME )
-        self.failUnless( isinstance( lm, DateTime ) )
-        self.assertEqual( lm, timestamp )
-
-    def test_getLastModified_subdir( self ):
-
-        from string import printable
-
-        SUBDIR = 'subdir'
-        FILENAME = os.path.join( SUBDIR, 'nested.txt' )
-        fqpath = self._makeFile( FILENAME, printable )
-        timestamp = os.path.getmtime( fqpath )
-
-        site = DummySite( 'site' ).__of__( self.root )
-        ctx = self._makeOne( site, self._PROFILE_PATH )
-
-        lm = ctx.getLastModified( FILENAME )
-        self.failUnless( isinstance( lm, DateTime ) )
-        self.assertEqual( lm, timestamp )
-
-    def test_getLastModified_directory( self ):
-
-        from string import printable
-
-        SUBDIR = 'subdir'
-        FILENAME = os.path.join( SUBDIR, 'nested.txt' )
-        fqpath = self._makeFile( FILENAME, printable )
-        path, file = os.path.split( fqpath )
-        timestamp = os.path.getmtime( path )
-
-        site = DummySite( 'site' ).__of__( self.root )
-        ctx = self._makeOne( site, self._PROFILE_PATH )
-
-        lm = ctx.getLastModified( SUBDIR )
-        self.failUnless( isinstance( lm, DateTime ) )
-        self.assertEqual( lm, timestamp )
-
-    def test_isDirectory_nonesuch( self ):
-
-        FILENAME = 'nonesuch.txt'
-
-        site = DummySite( 'site' ).__of__( self.root )
-        ctx = self._makeOne( site, self._PROFILE_PATH )
-
-        self.assertEqual( ctx.isDirectory( FILENAME ), None )
-
-    def test_isDirectory_simple( self ):
-
-        from string import printable
-
-        FILENAME = 'simple.txt'
-        fqpath = self._makeFile( FILENAME, printable )
-
-        site = DummySite( 'site' ).__of__( self.root )
-        ctx = self._makeOne( site, self._PROFILE_PATH )
-
-        self.assertEqual( ctx.isDirectory( FILENAME ), False )
-
-    def test_isDirectory_nested( self ):
-
-        from string import printable
-
-        SUBDIR = 'subdir'
-        FILENAME = os.path.join( SUBDIR, 'nested.txt' )
-        fqpath = self._makeFile( FILENAME, printable )
-
-        site = DummySite( 'site' ).__of__( self.root )
-        ctx = self._makeOne( site, self._PROFILE_PATH )
-
-        self.assertEqual( ctx.isDirectory( FILENAME ), False )
-
-    def test_isDirectory_directory( self ):
-
-        from string import printable
-
-        SUBDIR = 'subdir'
-        FILENAME = os.path.join( SUBDIR, 'nested.txt' )
-        fqpath = self._makeFile( FILENAME, printable )
-
-        site = DummySite( 'site' ).__of__( self.root )
-        ctx = self._makeOne( site, self._PROFILE_PATH )
-
-        self.assertEqual( ctx.isDirectory( SUBDIR ), True )
-
-    def test_listDirectory_nonesuch( self ):
-
-        FILENAME = 'nonesuch.txt'
-
-        site = DummySite( 'site' ).__of__( self.root )
-        ctx = self._makeOne( site, self._PROFILE_PATH )
-
-        self.assertEqual( ctx.listDirectory( FILENAME ), None )
-
-    def test_listDirectory_root( self ):
-
-        from string import printable
-
-        site = DummySite( 'site' ).__of__( self.root )
-        ctx = self._makeOne( site, self._PROFILE_PATH )
-
-        FILENAME = 'simple.txt'
-        self._makeFile( FILENAME, printable )
-
-        self.assertEqual( len( ctx.listDirectory( None ) ), 1 )
-        self.failUnless( FILENAME in ctx.listDirectory( None ) )
-
-    def test_listDirectory_simple( self ):
-
-        from string import printable
-
-        FILENAME = 'simple.txt'
-        self._makeFile( FILENAME, printable )
-
-        site = DummySite( 'site' ).__of__( self.root )
-        ctx = self._makeOne( site, self._PROFILE_PATH )
-
-        self.assertEqual( ctx.listDirectory( FILENAME ), None )
-
-    def test_listDirectory_nested( self ):
-
-        from string import printable
-
-        SUBDIR = 'subdir'
-        FILENAME = os.path.join( SUBDIR, 'nested.txt' )
-        self._makeFile( FILENAME, printable )
-
-        site = DummySite( 'site' ).__of__( self.root )
-        ctx = self._makeOne( site, self._PROFILE_PATH )
-
-        self.assertEqual( ctx.listDirectory( FILENAME ), None )
-
-    def test_listDirectory_single( self ):
-
-        from string import printable
-
-        SUBDIR = 'subdir'
-        FILENAME = os.path.join( SUBDIR, 'nested.txt' )
-        self._makeFile( FILENAME, printable )
-
-        site = DummySite( 'site' ).__of__( self.root )
-        ctx = self._makeOne( site, self._PROFILE_PATH )
-
-        names = ctx.listDirectory( SUBDIR )
-        self.assertEqual( len( names ), 1 )
-        self.failUnless( 'nested.txt' in names )
-
-    def test_listDirectory_multiple( self ):
-
-        from string import printable
-        SUBDIR = 'subdir'
-        FILENAME = os.path.join( SUBDIR, 'nested.txt' )
-        self._makeFile( FILENAME, printable )
-        self._makeFile( os.path.join( SUBDIR, 'another.txt' ), 'ABC' )
-
-        site = DummySite( 'site' ).__of__( self.root )
-        ctx = self._makeOne( site, self._PROFILE_PATH )
-
-        names = ctx.listDirectory( SUBDIR )
-        self.assertEqual( len( names ), 2 )
-        self.failUnless( 'nested.txt' in names )
-        self.failUnless( 'another.txt' in names )
-
-    def test_listDirectory_skip_implicit( self ):
-
-        from string import printable
-        SUBDIR = 'subdir'
-        FILENAME = os.path.join( SUBDIR, 'nested.txt' )
-        self._makeFile( FILENAME, printable )
-        self._makeFile( os.path.join( SUBDIR, 'another.txt' ), 'ABC' )
-        self._makeFile( os.path.join( SUBDIR, 'CVS/skip.txt' ), 'DEF' )
-        self._makeFile( os.path.join( SUBDIR, '.svn/skip.txt' ), 'GHI' )
-
-        site = DummySite( 'site' ).__of__( self.root )
-        ctx = self._makeOne( site, self._PROFILE_PATH )
-
-        names = ctx.listDirectory( SUBDIR )
-        self.assertEqual( len( names ), 2 )
-        self.failUnless( 'nested.txt' in names )
-        self.failUnless( 'another.txt' in names )
-        self.failIf( 'CVS' in names )
-        self.failIf( '.svn' in names )
-
-    def test_listDirectory_skip_explicit( self ):
-
-        from string import printable
-        SUBDIR = 'subdir'
-        FILENAME = os.path.join( SUBDIR, 'nested.txt' )
-        self._makeFile( FILENAME, printable )
-        self._makeFile( os.path.join( SUBDIR, 'another.txt' ), 'ABC' )
-        self._makeFile( os.path.join( SUBDIR, 'CVS/skip.txt' ), 'DEF' )
-        self._makeFile( os.path.join( SUBDIR, '.svn/skip.txt' ), 'GHI' )
-
-        site = DummySite( 'site' ).__of__( self.root )
-        ctx = self._makeOne( site, self._PROFILE_PATH )
-
-        names = ctx.listDirectory( SUBDIR, ( 'nested.txt', ) )
-        self.assertEqual( len( names ), 3 )
-        self.failIf( 'nested.txt' in names )
-        self.failUnless( 'another.txt' in names )
-        self.failUnless( 'CVS' in names )
-        self.failUnless( '.svn' in names )
-
-class DirectoryExportContextTests( FilesystemTestBase
-                                 , ConformsToISetupContext
-                                 , ConformsToIExportContext
-                                 ):
-
-    _PROFILE_PATH = '/tmp/ECTTexts'
-
-    def _getTargetClass( self ):
-
-        from Products.CMFSetup.context import DirectoryExportContext
-        return DirectoryExportContext
-
-    def test_writeDataFile_simple( self ):
-
-        from string import printable, digits
-        FILENAME = 'simple.txt'
-        fqname = self._makeFile( FILENAME, printable )
-
-        site = DummySite( 'site' ).__of__( self.root )
-        ctx = self._makeOne( site, self._PROFILE_PATH )
-
-        ctx.writeDataFile( FILENAME, digits, 'text/plain' )
-
-        self.assertEqual( open( fqname, 'rb' ).read(), digits )
-
-    def test_writeDataFile_new_subdir( self ):
-
-        from string import printable, digits
-        SUBDIR = 'subdir'
-        FILENAME = 'nested.txt'
-        fqname = os.path.join( self._PROFILE_PATH, SUBDIR, FILENAME )
-
-        site = DummySite( 'site' ).__of__( self.root )
-        ctx = self._makeOne( site, self._PROFILE_PATH )
-
-        ctx.writeDataFile( FILENAME, digits, 'text/plain', SUBDIR )
-
-        self.assertEqual( open( fqname, 'rb' ).read(), digits )
-
-    def test_writeDataFile_overwrite( self ):
-
-        from string import printable, digits
-        SUBDIR = 'subdir'
-        FILENAME = 'nested.txt'
-        fqname = self._makeFile( os.path.join( SUBDIR, FILENAME )
-                               , printable )
-
-        site = DummySite( 'site' ).__of__( self.root )
-        ctx = self._makeOne( site, self._PROFILE_PATH )
-
-        ctx.writeDataFile( FILENAME, digits, 'text/plain', SUBDIR )
-
-        self.assertEqual( open( fqname, 'rb' ).read(), digits )
-
-    def test_writeDataFile_existing_subdir( self ):
-
-        from string import printable, digits
-        SUBDIR = 'subdir'
-        FILENAME = 'nested.txt'
-        self._makeFile( os.path.join( SUBDIR, 'another.txt' ), printable )
-        fqname = os.path.join( self._PROFILE_PATH, SUBDIR, FILENAME )
-
-        site = DummySite( 'site' ).__of__( self.root )
-        ctx = self._makeOne( site, self._PROFILE_PATH )
-
-        ctx.writeDataFile( FILENAME, digits, 'text/plain', SUBDIR )
-
-        self.assertEqual( open( fqname, 'rb' ).read(), digits )
-
-
-class TarballExportContextTests( FilesystemTestBase
-                               , TarballTester
-                               , ConformsToISetupContext
-                               , ConformsToIExportContext
-                               ):
-
-    _PROFILE_PATH = '/tmp/TECT_tests'
-
-    def _getTargetClass( self ):
-
-        from Products.CMFSetup.context import TarballExportContext
-        return TarballExportContext
-
-    def test_writeDataFile_simple( self ):
-
-        from string import printable
-        now = long( time.time() )
-
-        site = DummySite( 'site' ).__of__( self.root )
-        ctx = self._getTargetClass()( site )
-
-        ctx.writeDataFile( 'foo.txt', printable, 'text/plain' )
-
-        fileish = StringIO( ctx.getArchive() )
-
-        self._verifyTarballContents( fileish, [ 'foo.txt' ], now )
-        self._verifyTarballEntry( fileish, 'foo.txt', printable )
-
-    def test_writeDataFile_multiple( self ):
-
-        from string import printable
-        from string import digits
-
-        site = DummySite( 'site' ).__of__( self.root )
-        ctx = self._getTargetClass()( site )
-
-        ctx.writeDataFile( 'foo.txt', printable, 'text/plain' )
-        ctx.writeDataFile( 'bar.txt', digits, 'text/plain' )
-
-        fileish = StringIO( ctx.getArchive() )
-
-        self._verifyTarballContents( fileish, [ 'foo.txt', 'bar.txt' ] )
-        self._verifyTarballEntry( fileish, 'foo.txt', printable )
-        self._verifyTarballEntry( fileish, 'bar.txt', digits )
-
-    def test_writeDataFile_subdir( self ):
-
-        from string import printable
-        from string import digits
-
-        site = DummySite( 'site' ).__of__( self.root )
-        ctx = self._getTargetClass()( site )
-
-        ctx.writeDataFile( 'foo.txt', printable, 'text/plain' )
-        ctx.writeDataFile( 'bar/baz.txt', digits, 'text/plain' )
-
-        fileish = StringIO( ctx.getArchive() )
-
-        self._verifyTarballContents( fileish, [ 'foo.txt', 'bar/baz.txt' ] )
-        self._verifyTarballEntry( fileish, 'foo.txt', printable )
-        self._verifyTarballEntry( fileish, 'bar/baz.txt', digits )
-
-
-class SnapshotExportContextTests( SecurityRequestTest
-                                , ConformsToISetupContext
-                                , ConformsToIExportContext
-                                ):
-
-    def _getTargetClass( self ):
-
-        from Products.CMFSetup.context import SnapshotExportContext
-        return SnapshotExportContext
-
-    def _makeOne( self, *args, **kw ):
-
-        return self._getTargetClass()( *args, **kw )
-
-    def test_writeDataFile_simple_image( self ):
-
-        from OFS.Image import Image
-        FILENAME = 'simple.txt'
-        _CONTENT_TYPE = 'image/png'
-        png_filename = os.path.join( os.path.split( __file__ )[0]
-                                   , 'simple.png' )
-        png_file = open( png_filename, 'rb' )
-        png_data = png_file.read()
-        png_file.close()
-
-        site = DummySite( 'site' ).__of__( self.root )
-        site.portal_setup = DummyTool( 'portal_setup' )
-        tool = site.portal_setup
-        ctx = self._makeOne( tool, 'simple' )
-
-        ctx.writeDataFile( FILENAME, png_data, _CONTENT_TYPE )
-
-        snapshot = tool.snapshots._getOb( 'simple' )
-
-        self.assertEqual( len( snapshot.objectIds() ), 1 )
-        self.failUnless( FILENAME in snapshot.objectIds() )
-
-        fileobj = snapshot._getOb( FILENAME )
-
-        self.assertEqual( fileobj.getId(), FILENAME )
-        self.assertEqual( fileobj.meta_type, Image.meta_type )
-        self.assertEqual( fileobj.getContentType(), _CONTENT_TYPE )
-        self.assertEqual( fileobj.data, png_data )
-
-    def test_writeDataFile_simple_plain_text( self ):
-
-        from string import digits
-        from OFS.Image import File
-        FILENAME = 'simple.txt'
-        _CONTENT_TYPE = 'text/plain'
-
-        site = DummySite( 'site' ).__of__( self.root )
-        site.portal_setup = DummyTool( 'portal_setup' )
-        tool = site.portal_setup
-        ctx = self._makeOne( tool, 'simple' )
-
-        ctx.writeDataFile( FILENAME, digits, _CONTENT_TYPE )
-
-        snapshot = tool.snapshots._getOb( 'simple' )
-
-        self.assertEqual( len( snapshot.objectIds() ), 1 )
-        self.failUnless( FILENAME in snapshot.objectIds() )
-
-        fileobj = snapshot._getOb( FILENAME )
-
-        self.assertEqual( fileobj.getId(), FILENAME )
-        self.assertEqual( fileobj.meta_type, File.meta_type )
-        self.assertEqual( fileobj.getContentType(), _CONTENT_TYPE )
-        self.assertEqual( str( fileobj ), digits )
-
-    def test_writeDataFile_simple_xml( self ):
-
-        from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate
-        FILENAME = 'simple.xml'
-        _CONTENT_TYPE = 'text/xml'
-        _XML = """<?xml version="1.0"?><simple />"""
-
-        site = DummySite( 'site' ).__of__( self.root )
-        site.portal_setup = DummyTool( 'portal_setup' )
-        tool = site.portal_setup
-        ctx = self._makeOne( tool, 'simple' )
-
-        ctx.writeDataFile( FILENAME, _XML, _CONTENT_TYPE )
-
-        snapshot = tool.snapshots._getOb( 'simple' )
-
-        self.assertEqual( len( snapshot.objectIds() ), 1 )
-        self.failUnless( FILENAME in snapshot.objectIds() )
-
-        template = snapshot._getOb( FILENAME )
-
-        self.assertEqual( template.getId(), FILENAME )
-        self.assertEqual( template.meta_type, ZopePageTemplate.meta_type )
-        self.assertEqual( template.read(), _XML )
-        self.failIf( template.html() )
-
-    def test_writeDataFile_unicode_xml( self ):
-
-        from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate
-        FILENAME = 'simple.xml'
-        _CONTENT_TYPE = 'text/xml'
-        _XML = u"""<?xml version="1.0"?><simple />"""
-
-        site = DummySite( 'site' ).__of__( self.root )
-        site.portal_setup = DummyTool( 'portal_setup' )
-        tool = site.portal_setup
-        ctx = self._makeOne( tool, 'simple' )
-
-        ctx.writeDataFile( FILENAME, _XML, _CONTENT_TYPE )
-
-        snapshot = tool.snapshots._getOb( 'simple' )
-
-        self.assertEqual( len( snapshot.objectIds() ), 1 )
-        self.failUnless( FILENAME in snapshot.objectIds() )
-
-        template = snapshot._getOb( FILENAME )
-
-        self.assertEqual( template.getId(), FILENAME )
-        self.assertEqual( template.meta_type, ZopePageTemplate.meta_type )
-        self.assertEqual( template.read(), _XML )
-        self.failIf( template.html() )
-
-    def test_writeDataFile_subdir_dtml( self ):
-
-        from OFS.DTMLDocument import DTMLDocument
-        FILENAME = 'simple.dtml'
-        _CONTENT_TYPE = 'text/html'
-        _HTML = """<html><body><h1>HTML</h1></body></html>"""
-
-        site = DummySite( 'site' ).__of__( self.root )
-        site.portal_setup = DummyTool( 'portal_setup' )
-        tool = site.portal_setup
-        ctx = self._makeOne( tool, 'simple' )
-
-        ctx.writeDataFile( FILENAME, _HTML, _CONTENT_TYPE, 'sub1' )
-
-        snapshot = tool.snapshots._getOb( 'simple' )
-        sub1 = snapshot._getOb( 'sub1' )
-
-        self.assertEqual( len( sub1.objectIds() ), 1 )
-        self.failUnless( FILENAME in sub1.objectIds() )
-
-        template = sub1._getOb( FILENAME )
-
-        self.assertEqual( template.getId(), FILENAME )
-        self.assertEqual( template.meta_type, DTMLDocument.meta_type )
-        self.assertEqual( template.read(), _HTML )
-
-    def test_writeDataFile_nested_subdirs_html( self ):
-
-        from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate
-        FILENAME = 'simple.html'
-        _CONTENT_TYPE = 'text/html'
-        _HTML = """<html><body><h1>HTML</h1></body></html>"""
-
-        site = DummySite( 'site' ).__of__( self.root )
-        site.portal_setup = DummyTool( 'portal_setup' )
-        tool = site.portal_setup
-        ctx = self._makeOne( tool, 'simple' )
-
-        ctx.writeDataFile( FILENAME, _HTML, _CONTENT_TYPE, 'sub1/sub2' )
-
-        snapshot = tool.snapshots._getOb( 'simple' )
-        sub1 = snapshot._getOb( 'sub1' )
-        sub2 = sub1._getOb( 'sub2' )
-
-        self.assertEqual( len( sub2.objectIds() ), 1 )
-        self.failUnless( FILENAME in sub2.objectIds() )
-
-        template = sub2._getOb( FILENAME )
-
-        self.assertEqual( template.getId(), FILENAME )
-        self.assertEqual( template.meta_type, ZopePageTemplate.meta_type )
-        self.assertEqual( template.read(), _HTML )
-        self.failUnless( template.html() )
-
-    def test_writeDataFile_multiple( self ):
-
-        from string import printable
-        from string import digits
-
-        site = DummySite( 'site' ).__of__( self.root )
-        site.portal_setup = DummyTool( 'portal_setup' )
-        tool = site.portal_setup
-        ctx = self._makeOne( tool, 'multiple' )
-
-        ctx.writeDataFile( 'foo.txt', printable, 'text/plain' )
-        ctx.writeDataFile( 'bar.txt', digits, 'text/plain' )
-
-        snapshot = tool.snapshots._getOb( 'multiple' )
-
-        self.assertEqual( len( snapshot.objectIds() ), 2 )
-
-        for id in [ 'foo.txt', 'bar.txt' ]:
-            self.failUnless( id in snapshot.objectIds() )
-
-
-class SnapshotImportContextTests( SecurityRequestTest
-                                , ConformsToISetupContext
-                                , ConformsToIImportContext
-                                ):
-
-    def _getTargetClass( self ):
-
-        from Products.CMFSetup.context import SnapshotImportContext
-        return SnapshotImportContext
-
-    def _makeOne( self, context_id, *args, **kw ):
-
-        site = DummySite( 'site' ).__of__( self.root )
-        site._setObject( 'portal_setup', Folder( 'portal_setup' ) )
-        tool = site._getOb( 'portal_setup' )
-
-        tool._setObject( 'snapshots', Folder( 'snapshots' ) )
-        tool.snapshots._setObject( context_id, Folder( context_id ) )
-
-        ctx = self._getTargetClass()( tool, context_id, *args, **kw )
-
-        return site, tool, ctx.__of__( tool )
-
-    def _makeFile( self
-                 , tool
-                 , snapshot_id
-                 , filename
-                 , contents
-                 , content_type='text/plain'
-                 , mod_time=None
-                 , subdir=None
-                 ):
-
-        snapshots = tool._getOb( 'snapshots' )
-        folder = snapshot = snapshots._getOb( snapshot_id )
-
-        if subdir is not None:
-
-            for element in subdir.split( '/' ):
-
-                try:
-                    folder = folder._getOb( element )
-                except AttributeError:
-                    folder._setObject( element, Folder( element ) )
-                    folder = folder._getOb( element )
-
-        file = File( filename, '', contents, content_type )
-        folder._setObject( filename, file )
-
-        if mod_time is not None:
-
-            def __faux_mod_time():
-                return mod_time
-
-            folder.bobobase_modification_time = \
-            file.bobobase_modification_time = __faux_mod_time
-
-        return folder._getOb( filename )
-
-    def test_ctorparms( self ):
-
-        SNAPSHOT_ID = 'ctorparms'
-        ENCODING = 'latin-1'
-        site, tool, ctx = self._makeOne( SNAPSHOT_ID
-                                       , encoding=ENCODING
-                                       , should_purge=True
-                                       )
-
-        self.assertEqual( ctx.getEncoding(), ENCODING )
-        self.assertEqual( ctx.shouldPurge(), True )
-
-    def test_empty( self ):
-
-        SNAPSHOT_ID = 'empty'
-        site, tool, ctx = self._makeOne( SNAPSHOT_ID )
-
-        self.assertEqual( ctx.getSite(), site )
-        self.assertEqual( ctx.getEncoding(), None )
-        self.assertEqual( ctx.shouldPurge(), False )
-
-        # These methods are all specified to return 'None' for non-existing
-        # paths / entities
-        self.assertEqual( ctx.isDirectory( 'nonesuch/path' ), None )
-        self.assertEqual( ctx.listDirectory( 'nonesuch/path' ), None )
-
-    def test_readDataFile_nonesuch( self ):
-
-        SNAPSHOT_ID = 'readDataFile_nonesuch'
-        FILENAME = 'nonesuch.txt'
-
-        site, tool, ctx = self._makeOne( SNAPSHOT_ID )
-
-        self.assertEqual( ctx.readDataFile( FILENAME ), None )
-        self.assertEqual( ctx.readDataFile( FILENAME, 'subdir' ), None )
-
-    def test_readDataFile_simple( self ):
-
-        from string import printable
-
-        SNAPSHOT_ID = 'readDataFile_simple'
-        FILENAME = 'simple.txt'
-
-        site, tool, ctx = self._makeOne( SNAPSHOT_ID )
-        self._makeFile( tool, SNAPSHOT_ID, FILENAME, printable )
-
-        self.assertEqual( ctx.readDataFile( FILENAME ), printable )
-
-    def test_readDataFile_subdir( self ):
-
-        from string import printable
-
-        SNAPSHOT_ID = 'readDataFile_subdir'
-        FILENAME = 'subdir.txt'
-        SUBDIR = 'subdir'
-
-        site, tool, ctx = self._makeOne( SNAPSHOT_ID )
-        self._makeFile( tool, SNAPSHOT_ID, FILENAME, printable
-                      , subdir=SUBDIR )
-
-        self.assertEqual( ctx.readDataFile( FILENAME, SUBDIR ), printable )
-
-    def test_getLastModified_nonesuch( self ):
-
-        SNAPSHOT_ID = 'getLastModified_nonesuch'
-        FILENAME = 'nonesuch.txt'
-
-        site, tool, ctx = self._makeOne( SNAPSHOT_ID )
-
-        self.assertEqual( ctx.getLastModified( FILENAME ), None )
-
-    def test_getLastModified_simple( self ):
-
-        from string import printable
-
-        SNAPSHOT_ID = 'getLastModified_simple'
-        FILENAME = 'simple.txt'
-        WHEN = DateTime( '2004-01-01T00:00:00Z' )
-
-        site, tool, ctx = self._makeOne( SNAPSHOT_ID )
-        file = self._makeFile( tool, SNAPSHOT_ID, FILENAME, printable
-                             , mod_time=WHEN )
-
-        self.assertEqual( ctx.getLastModified( FILENAME ), WHEN )
-
-    def test_getLastModified_subdir( self ):
-
-        from string import printable
-
-        SNAPSHOT_ID = 'getLastModified_subdir'
-        FILENAME = 'subdir.txt'
-        SUBDIR = 'subdir'
-        PATH = '%s/%s' % ( SUBDIR, FILENAME )
-        WHEN = DateTime( '2004-01-01T00:00:00Z' )
-
-        site, tool, ctx = self._makeOne( SNAPSHOT_ID )
-        file = self._makeFile( tool, SNAPSHOT_ID, FILENAME, printable
-                             , mod_time=WHEN, subdir=SUBDIR )
-
-        self.assertEqual( ctx.getLastModified( PATH ), WHEN )
-
-    def test_getLastModified_directory( self ):
-
-        from string import printable
-
-        SNAPSHOT_ID = 'readDataFile_subdir'
-        FILENAME = 'subdir.txt'
-        SUBDIR = 'subdir'
-        WHEN = DateTime( '2004-01-01T00:00:00Z' )
-
-        site, tool, ctx = self._makeOne( SNAPSHOT_ID )
-        file = self._makeFile( tool, SNAPSHOT_ID, FILENAME, printable
-                             , mod_time=WHEN, subdir=SUBDIR )
-
-        self.assertEqual( ctx.getLastModified( SUBDIR ), WHEN )
-
-    def test_isDirectory_nonesuch( self ):
-
-        SNAPSHOT_ID = 'isDirectory_nonesuch'
-        FILENAME = 'nonesuch.txt'
-
-        site, tool, ctx = self._makeOne( SNAPSHOT_ID )
-
-        self.assertEqual( ctx.isDirectory( FILENAME ), None )
-
-    def test_isDirectory_simple( self ):
-
-        from string import printable
-
-        SNAPSHOT_ID = 'isDirectory_simple'
-        FILENAME = 'simple.txt'
-
-        site, tool, ctx = self._makeOne( SNAPSHOT_ID )
-        file = self._makeFile( tool, SNAPSHOT_ID, FILENAME, printable )
-
-        self.assertEqual( ctx.isDirectory( FILENAME ), False )
-
-    def test_isDirectory_nested( self ):
-
-        from string import printable
-
-        SNAPSHOT_ID = 'isDirectory_nested'
-        SUBDIR = 'subdir'
-        FILENAME = 'nested.txt'
-        PATH = '%s/%s' % ( SUBDIR, FILENAME )
-
-        site, tool, ctx = self._makeOne( SNAPSHOT_ID )
-        file = self._makeFile( tool, SNAPSHOT_ID, FILENAME, printable
-                             , subdir=SUBDIR )
-
-        self.assertEqual( ctx.isDirectory( PATH ), False )
-
-    def test_isDirectory_subdir( self ):
-
-        from string import printable
-
-        SNAPSHOT_ID = 'isDirectory_subdir'
-        SUBDIR = 'subdir'
-        FILENAME = 'nested.txt'
-        PATH = '%s/%s' % ( SUBDIR, FILENAME )
-
-        site, tool, ctx = self._makeOne( SNAPSHOT_ID )
-        file = self._makeFile( tool, SNAPSHOT_ID, FILENAME, printable
-                             , subdir=SUBDIR )
-
-        self.assertEqual( ctx.isDirectory( SUBDIR ), True )
-
-    def test_listDirectory_nonesuch( self ):
-
-        SNAPSHOT_ID = 'listDirectory_nonesuch'
-        SUBDIR = 'nonesuch/path'
-
-        site, tool, ctx = self._makeOne( SNAPSHOT_ID )
-
-        self.assertEqual( ctx.listDirectory( SUBDIR ), None )
-
-    def test_listDirectory_root( self ):
-
-        from string import printable
-
-        SNAPSHOT_ID = 'listDirectory_root'
-        FILENAME = 'simple.txt'
-
-        site, tool, ctx = self._makeOne( SNAPSHOT_ID )
-        file = self._makeFile( tool, SNAPSHOT_ID, FILENAME, printable )
-
-        self.assertEqual( len( ctx.listDirectory( None ) ), 1 )
-        self.failUnless( FILENAME in ctx.listDirectory( None ) )
-
-    def test_listDirectory_simple( self ):
-
-        from string import printable
-
-        SNAPSHOT_ID = 'listDirectory_simple'
-        FILENAME = 'simple.txt'
-
-        site, tool, ctx = self._makeOne( SNAPSHOT_ID )
-        file = self._makeFile( tool, SNAPSHOT_ID, FILENAME, printable )
-
-        self.assertEqual( ctx.listDirectory( FILENAME ), None )
-
-    def test_listDirectory_nested( self ):
-
-        from string import printable
-
-        SNAPSHOT_ID = 'listDirectory_nested'
-        SUBDIR = 'subdir'
-        FILENAME = 'nested.txt'
-        PATH = '%s/%s' % ( SUBDIR, FILENAME )
-
-        site, tool, ctx = self._makeOne( SNAPSHOT_ID )
-        file = self._makeFile( tool, SNAPSHOT_ID, FILENAME, printable
-                             , subdir=SUBDIR )
-
-        self.assertEqual( ctx.listDirectory( PATH ), None )
-
-    def test_listDirectory_single( self ):
-
-        from string import printable
-
-        SNAPSHOT_ID = 'listDirectory_nested'
-        SUBDIR = 'subdir'
-        FILENAME = 'nested.txt'
-
-        site, tool, ctx = self._makeOne( SNAPSHOT_ID )
-        file = self._makeFile( tool, SNAPSHOT_ID, FILENAME, printable
-                             , subdir=SUBDIR )
-
-        names = ctx.listDirectory( SUBDIR )
-        self.assertEqual( len( names ), 1 )
-        self.failUnless( FILENAME in names )
-
-    def test_listDirectory_multiple( self ):
-
-        from string import printable, uppercase
-
-        SNAPSHOT_ID = 'listDirectory_nested'
-        SUBDIR = 'subdir'
-        FILENAME1 = 'nested.txt'
-        FILENAME2 = 'another.txt'
-
-        site, tool, ctx = self._makeOne( SNAPSHOT_ID )
-        file1 = self._makeFile( tool, SNAPSHOT_ID, FILENAME1, printable
-                              , subdir=SUBDIR )
-        file2 = self._makeFile( tool, SNAPSHOT_ID, FILENAME2, uppercase
-                              , subdir=SUBDIR )
-
-        names = ctx.listDirectory( SUBDIR )
-        self.assertEqual( len( names ), 2 )
-        self.failUnless( FILENAME1 in names )
-        self.failUnless( FILENAME2 in names )
-
-    def test_listDirectory_skip( self ):
-
-        from string import printable, uppercase
-
-        SNAPSHOT_ID = 'listDirectory_nested'
-        SUBDIR = 'subdir'
-        FILENAME1 = 'nested.txt'
-        FILENAME2 = 'another.txt'
-
-        site, tool, ctx = self._makeOne( SNAPSHOT_ID )
-        file1 = self._makeFile( tool, SNAPSHOT_ID, FILENAME1, printable
-                              , subdir=SUBDIR )
-        file2 = self._makeFile( tool, SNAPSHOT_ID, FILENAME2, uppercase
-                              , subdir=SUBDIR )
-
-        names = ctx.listDirectory( SUBDIR, skip=( FILENAME1, ) )
-        self.assertEqual( len( names ), 1 )
-        self.failIf( FILENAME1 in names )
-        self.failUnless( FILENAME2 in names )
-
-
-def test_suite():
-    return unittest.TestSuite((
-        unittest.makeSuite( DirectoryImportContextTests ),
-        unittest.makeSuite( DirectoryExportContextTests ),
-        unittest.makeSuite( TarballExportContextTests ),
-        unittest.makeSuite( SnapshotExportContextTests ),
-        unittest.makeSuite( SnapshotImportContextTests ),
-        ))
-
-if __name__ == '__main__':
-    unittest.main(defaultTest='test_suite')

Deleted: CMF/trunk/CMFSetup/tests/test_differ.py
===================================================================
--- CMF/trunk/CMFSetup/tests/test_differ.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFSetup/tests/test_differ.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -1,406 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004 Zope Corporation and Contributors. All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-""" Unit tests for differ module.
-
-$Id$
-"""
-
-import unittest
-import Testing
-import Zope2
-Zope2.startup()
-
-from OFS.Folder import Folder
-from OFS.Image import File
-
-from DateTime.DateTime import DateTime
-from Products.CMFCore.tests.base.testcase import SecurityRequestTest
-
-
-class DummySite( Folder ):
-
-    pass
-
-
-class Test_unidiff( unittest.TestCase ):
-
-    def test_unidiff_both_text( self ):
-
-        from Products.CMFSetup.differ import unidiff
-
-        diff_lines = unidiff( ONE_FOUR, ZERO_FOUR )
-        diff_text = '\n'.join( diff_lines )
-        self.assertEqual( diff_text, DIFF_TEXT )
-
-    def test_unidiff_both_lines( self ):
-
-        from Products.CMFSetup.differ import unidiff
-
-        diff_lines = unidiff( ONE_FOUR.splitlines(), ZERO_FOUR.splitlines() )
-        diff_text = '\n'.join( diff_lines )
-        self.assertEqual( diff_text, DIFF_TEXT )
-
-    def test_unidiff_mixed( self ):
-
-        from Products.CMFSetup.differ import unidiff
-
-        diff_lines = unidiff( ONE_FOUR, ZERO_FOUR.splitlines() )
-        diff_text = '\n'.join( diff_lines )
-        self.assertEqual( diff_text, DIFF_TEXT )
-
-    def test_unidiff_ignore_blanks( self ):
-
-        from Products.CMFSetup.differ import unidiff
-
-        double_spaced = ONE_FOUR.replace( '\n', '\n\n' )
-        diff_lines = unidiff( double_spaced
-                            , ZERO_FOUR.splitlines()
-                            , ignore_blanks=True
-                            )
-
-        diff_text = '\n'.join( diff_lines )
-        self.assertEqual( diff_text, DIFF_TEXT )
-
-ZERO_FOUR = """\
-zero
-one
-tree
-four
-"""
-
-ONE_FOUR = """\
-one
-two
-three
-four
-"""
-
-DIFF_TEXT = """\
---- original None
-+++ modified None
-@@ -1,4 +1,4 @@
-+zero
- one
--two
--three
-+tree
- four\
-"""
-
-class ConfigDiffTests( SecurityRequestTest ):
-
-    site = None
-    tool = None
-
-    def _getTargetClass( self ):
-
-        from Products.CMFSetup.differ import ConfigDiff
-        return ConfigDiff
-
-    def _makeOne( self, lhs, rhs, *args, **kw ):
-
-        return self._getTargetClass()( lhs, rhs, *args, **kw )
-
-    def _makeSite( self ):
-
-        if self.site is not None:
-            return
-
-        site = self.site = DummySite( 'site' ).__of__( self.root )
-        site._setObject( 'portal_setup', Folder( 'portal_setup' ) )
-        self.tool = tool = site._getOb( 'portal_setup' )
-
-        tool._setObject( 'snapshots', Folder( 'snapshots' ) )
-
-    def _makeContext( self, context_id ):
-
-        from Products.CMFSetup.context import SnapshotImportContext
-
-        self._makeSite()
-
-        if context_id not in self.tool.snapshots.objectIds():
-            self.tool.snapshots._setObject( context_id, Folder( context_id ) )
-
-        ctx = SnapshotImportContext( self.tool, context_id )
-
-        return ctx.__of__( self.tool )
-
-    def _makeDirectory( self, snapshot_id, subdir ):
-
-        self._makeSite()
-        folder = self.tool.snapshots._getOb( snapshot_id )
-
-        for element in subdir.split( '/' ):
-
-            try:
-                folder = folder._getOb( element )
-            except AttributeError:
-                folder._setObject( element, Folder( element ) )
-                folder = folder._getOb( element )
-
-        return folder
-
-    def _makeFile( self
-                 , snapshot_id
-                 , filename
-                 , contents
-                 , content_type='text/plain'
-                 , mod_time=None
-                 , subdir=None
-                 ):
-
-        self._makeSite()
-        snapshots = self.tool.snapshots
-        snapshot = snapshots._getOb( snapshot_id )
-
-        if subdir is not None:
-            folder = self._makeDirectory( snapshot_id, subdir )
-        else:
-            folder = snapshot
-
-        file = File( filename, '', contents, content_type )
-        folder._setObject( filename, file )
-
-        if mod_time is not None:
-
-            def __faux_mod_time():
-                return mod_time
-
-            folder.bobobase_modification_time = \
-            file.bobobase_modification_time = __faux_mod_time
-
-        return folder._getOb( filename )
-
-    def test_compare_empties( self ):
-
-        lhs = self._makeContext( 'lhs' )
-        rhs = self._makeContext( 'rhs' )
-
-        cd = self._makeOne( lhs, rhs )
-
-        diffs = cd.compare()
-
-        self.assertEqual( diffs, '' )
-
-    def test_compare_identical( self ):
-
-        lhs = self._makeContext( 'lhs' )
-        rhs = self._makeContext( 'rhs' )
-
-        self._makeFile( 'lhs', 'test.txt', 'ABCDEF' )
-        self._makeFile( 'lhs', 'again.txt', 'GHIJKL', subdir='sub' )
-        self._makeFile( 'rhs', 'test.txt', 'ABCDEF' )
-        self._makeFile( 'rhs', 'again.txt', 'GHIJKL', subdir='sub' )
-
-        cd = self._makeOne( lhs, rhs )
-
-        diffs = cd.compare()
-
-        self.assertEqual( diffs, '' )
-
-    def test_compare_changed_file( self ):
-
-        BEFORE = DateTime( '2004-01-01T00:00:00Z' )
-        AFTER = DateTime( '2004-02-29T23:59:59Z' )
-
-        lhs = self._makeContext( 'lhs' )
-        rhs = self._makeContext( 'rhs' )
-
-        self._makeFile( 'lhs', 'test.txt', 'ABCDEF\nWXYZ', mod_time=BEFORE )
-        self._makeFile( 'lhs', 'again.txt', 'GHIJKL', subdir='sub' )
-        self._makeFile( 'rhs', 'test.txt', 'ABCDEF\nQRST', mod_time=AFTER )
-        self._makeFile( 'rhs', 'again.txt', 'GHIJKL', subdir='sub' )
-
-        cd = self._makeOne( lhs, rhs )
-
-        diffs = cd.compare()
-
-        self.assertEqual( diffs, TEST_TXT_DIFFS % ( BEFORE, AFTER ) )
-
-    def test_compare_changed_file_ignore_blanks( self ):
-
-        BEFORE = DateTime( '2004-01-01T00:00:00Z' )
-        AFTER = DateTime( '2004-02-29T23:59:59Z' )
-
-        lhs = self._makeContext( 'lhs' )
-        rhs = self._makeContext( 'rhs' )
-
-        self._makeFile( 'lhs', 'test.txt', 'ABCDEF\nWXYZ', mod_time=BEFORE )
-        self._makeFile( 'rhs', 'test.txt', 'ABCDEF\n\n\nWXYZ', mod_time=AFTER )
-
-        cd = self._makeOne( lhs, rhs, ignore_blanks=True )
-
-        diffs = cd.compare()
-
-        self.assertEqual( diffs, '' )
-
-    def test_compare_changed_file_explicit_skip( self ):
-
-        BEFORE = DateTime( '2004-01-01T00:00:00Z' )
-        AFTER = DateTime( '2004-02-29T23:59:59Z' )
-
-        lhs = self._makeContext( 'lhs' )
-        rhs = self._makeContext( 'rhs' )
-
-        self._makeFile( 'lhs', 'test.txt', 'ABCDEF\nWXYZ', subdir='skipme'
-                      , mod_time=BEFORE )
-        self._makeFile( 'lhs', 'again.txt', 'GHIJKL', subdir='sub' )
-        self._makeFile( 'rhs', 'test.txt', 'ABCDEF\nQRST', subdir='skipme'
-                      , mod_time=AFTER )
-        self._makeFile( 'rhs', 'again.txt', 'GHIJKL', subdir='sub' )
-
-        cd = self._makeOne( lhs, rhs, skip=[ 'skipme' ] )
-
-        diffs = cd.compare()
-
-        self.assertEqual( diffs, '' )
-
-    def test_compare_changed_file_implicit_skip( self ):
-
-        BEFORE = DateTime( '2004-01-01T00:00:00Z' )
-        AFTER = DateTime( '2004-02-29T23:59:59Z' )
-
-        lhs = self._makeContext( 'lhs' )
-        rhs = self._makeContext( 'rhs' )
-
-        self._makeFile( 'lhs', 'test.txt', 'ABCDEF\nWXYZ', subdir='CVS'
-                      , mod_time=BEFORE )
-        self._makeFile( 'lhs', 'again.txt', 'GHIJKL', subdir='.svn'
-                      , mod_time=BEFORE )
-
-        self._makeFile( 'rhs', 'test.txt', 'ABCDEF\nQRST', subdir='CVS'
-                      , mod_time=AFTER )
-        self._makeFile( 'rhs', 'again.txt', 'MNOPQR', subdir='.svn'
-                      , mod_time=AFTER )
-
-        cd = self._makeOne( lhs, rhs )
-
-        diffs = cd.compare()
-
-        self.assertEqual( diffs, '' )
-
-    def test_compare_added_file_no_missing_as_empty( self ):
-
-        lhs = self._makeContext( 'lhs' )
-        rhs = self._makeContext( 'rhs' )
-
-        self._makeFile( 'lhs', 'test.txt', 'ABCDEF\nWXYZ' )
-        self._makeDirectory( 'lhs', subdir='sub' )
-        self._makeFile( 'rhs', 'test.txt', 'ABCDEF\nWXYZ' )
-        self._makeFile( 'rhs', 'again.txt', 'GHIJKL', subdir='sub' )
-
-        cd = self._makeOne( lhs, rhs )
-
-        diffs = cd.compare()
-
-        self.assertEqual( diffs, ADDED_FILE_DIFFS_NO_MAE )
-
-    def test_compare_added_file_missing_as_empty( self ):
-
-        AFTER = DateTime( '2004-02-29T23:59:59Z' )
-        lhs = self._makeContext( 'lhs' )
-        rhs = self._makeContext( 'rhs' )
-
-        self._makeFile( 'lhs', 'test.txt', 'ABCDEF\nWXYZ' )
-        self._makeDirectory( 'lhs', subdir='sub' )
-        self._makeFile( 'rhs', 'test.txt', 'ABCDEF\nWXYZ' )
-        self._makeFile( 'rhs', 'again.txt', 'GHIJKL', subdir='sub'
-                      , mod_time=AFTER )
-
-        cd = self._makeOne( lhs, rhs, missing_as_empty=True )
-
-        diffs = cd.compare()
-
-        self.assertEqual( diffs, ADDED_FILE_DIFFS_MAE % AFTER )
-
-    def test_compare_removed_file_no_missing_as_empty( self ):
-
-        lhs = self._makeContext( 'lhs' )
-        rhs = self._makeContext( 'rhs' )
-
-        self._makeFile( 'lhs', 'test.txt', 'ABCDEF\nWXYZ' )
-        self._makeFile( 'lhs', 'again.txt', 'GHIJKL', subdir='sub' )
-        self._makeFile( 'rhs', 'test.txt', 'ABCDEF\nWXYZ' )
-        self._makeDirectory( 'rhs', subdir='sub' )
-
-        cd = self._makeOne( lhs, rhs )
-
-        diffs = cd.compare()
-
-        self.assertEqual( diffs, REMOVED_FILE_DIFFS_NO_MAE )
-
-    def test_compare_removed_file_missing_as_empty( self ):
-
-        BEFORE = DateTime( '2004-01-01T00:00:00Z' )
-        lhs = self._makeContext( 'lhs' )
-        rhs = self._makeContext( 'rhs' )
-
-        self._makeFile( 'lhs', 'test.txt', 'ABCDEF\nWXYZ' )
-        self._makeFile( 'lhs', 'again.txt', 'GHIJKL', subdir='sub'
-                      , mod_time=BEFORE )
-        self._makeFile( 'rhs', 'test.txt', 'ABCDEF\nWXYZ' )
-        self._makeDirectory( 'rhs', subdir='sub' )
-
-        cd = self._makeOne( lhs, rhs, missing_as_empty=True )
-
-        diffs = cd.compare()
-
-        self.assertEqual( diffs, REMOVED_FILE_DIFFS_MAE % BEFORE )
-
-
-TEST_TXT_DIFFS = """\
-Index: test.txt
-===================================================================
---- test.txt %s
-+++ test.txt %s
-@@ -1,2 +1,2 @@
- ABCDEF
--WXYZ
-+QRST\
-"""
-
-ADDED_FILE_DIFFS_NO_MAE = """\
-** File sub/again.txt added
-"""
-
-ADDED_FILE_DIFFS_MAE = """\
-Index: sub/again.txt
-===================================================================
---- sub/again.txt 0
-+++ sub/again.txt %s
-@@ -1,0 +1,1 @@
-+GHIJKL\
-"""
-
-REMOVED_FILE_DIFFS_NO_MAE = """\
-** File sub/again.txt removed
-"""
-
-REMOVED_FILE_DIFFS_MAE = """\
-Index: sub/again.txt
-===================================================================
---- sub/again.txt %s
-+++ sub/again.txt 0
-@@ -1,1 +1,0 @@
--GHIJKL\
-"""
-
-
-def test_suite():
-    return unittest.TestSuite((
-        unittest.makeSuite( Test_unidiff ),
-        unittest.makeSuite( ConfigDiffTests ),
-        ))
-
-if __name__ == '__main__':
-    unittest.main(defaultTest='test_suite')

Deleted: CMF/trunk/CMFSetup/tests/test_registry.py
===================================================================
--- CMF/trunk/CMFSetup/tests/test_registry.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFSetup/tests/test_registry.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -1,1098 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004 Zope Corporation and Contributors. All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-""" Registry unit tests.
-
-$Id$
-"""
-
-import unittest
-import Testing
-import Zope2
-Zope2.startup()
-
-from OFS.Folder import Folder
-from Products.CMFSetup.tests.common import BaseRegistryTests
-from Products.CMFSetup import EXTENSION
-
-from conformance import ConformsToIStepRegistry
-from conformance import ConformsToIImportStepRegistry
-from conformance import ConformsToIExportStepRegistry
-from conformance import ConformsToIToolsetRegistry
-from conformance import ConformsToIProfileRegistry
-
-
-#==============================================================================
-#   Dummy handlers
-#==============================================================================
-def ONE_FUNC( context ): pass
-def TWO_FUNC( context ): pass
-def THREE_FUNC( context ): pass
-def FOUR_FUNC( context ): pass
-
-ONE_FUNC_NAME = '%s.%s' % ( __name__, ONE_FUNC.__name__ )
-TWO_FUNC_NAME = '%s.%s' % ( __name__, TWO_FUNC.__name__ )
-THREE_FUNC_NAME = '%s.%s' % ( __name__, THREE_FUNC.__name__ )
-FOUR_FUNC_NAME = '%s.%s' % ( __name__, FOUR_FUNC.__name__ )
-
-
-#==============================================================================
-#   SSR tests
-#==============================================================================
-class ImportStepRegistryTests( BaseRegistryTests
-                             , ConformsToIStepRegistry
-                             , ConformsToIImportStepRegistry
-                             ):
-
-    def _getTargetClass( self ):
-
-        from Products.CMFSetup.registry import ImportStepRegistry
-        return ImportStepRegistry
-
-    def test_empty( self ):
-
-        registry = self._makeOne()
-
-        self.assertEqual( len( registry.listSteps() ), 0 )
-        self.assertEqual( len( registry.listStepMetadata() ), 0 )
-        self.assertEqual( len( registry.sortSteps() ), 0 )
-
-    def test_getStep_nonesuch( self ):
-
-        registry = self._makeOne()
-
-        self.assertEqual( registry.getStep( 'nonesuch' ), None )
-        self.assertEqual( registry.getStep( 'nonesuch' ), None )
-        default = object()
-        self.failUnless( registry.getStepMetadata( 'nonesuch'
-                                                 , default ) is default )
-        self.failUnless( registry.getStep( 'nonesuch', default ) is default )
-        self.failUnless( registry.getStepMetadata( 'nonesuch'
-                                                 , default ) is default )
-
-    def test_getStep_defaulted( self ):
-
-        registry = self._makeOne()
-        default = object()
-
-        self.failUnless( registry.getStep( 'nonesuch', default ) is default )
-        self.assertEqual( registry.getStepMetadata( 'nonesuch', {} ), {} )
-
-    def test_registerStep_docstring( self ):
-
-        def func_with_doc( site ):
-            """This is the first line.
-
-            This is the second line.
-            """
-        FUNC_NAME = '%s.%s' % ( __name__, func_with_doc.__name__ )
-
-        registry = self._makeOne()
-
-        registry.registerStep( id='docstring'
-                             , version='1'
-                             , handler=func_with_doc
-                             , dependencies=()
-                             )
-
-        info = registry.getStepMetadata( 'docstring' )
-        self.assertEqual( info[ 'id' ], 'docstring' )
-        self.assertEqual( info[ 'handler' ], FUNC_NAME )
-        self.assertEqual( info[ 'dependencies' ], () )
-        self.assertEqual( info[ 'title' ], 'This is the first line.' )
-        self.assertEqual( info[ 'description' ] , 'This is the second line.' )
-
-    def test_registerStep_docstring_override( self ):
-
-        def func_with_doc( site ):
-            """This is the first line.
-
-            This is the second line.
-            """
-        FUNC_NAME = '%s.%s' % ( __name__, func_with_doc.__name__ )
-
-        registry = self._makeOne()
-
-        registry.registerStep( id='docstring'
-                             , version='1'
-                             , handler=func_with_doc
-                             , dependencies=()
-                             , title='Title'
-                             )
-
-        info = registry.getStepMetadata( 'docstring' )
-        self.assertEqual( info[ 'id' ], 'docstring' )
-        self.assertEqual( info[ 'handler' ], FUNC_NAME )
-        self.assertEqual( info[ 'dependencies' ], () )
-        self.assertEqual( info[ 'title' ], 'Title' )
-        self.assertEqual( info[ 'description' ] , 'This is the second line.' )
-
-    def test_registerStep_single( self ):
-
-        registry = self._makeOne()
-
-        registry.registerStep( id='one'
-                             , version='1'
-                             , handler=ONE_FUNC
-                             , dependencies=( 'two', 'three' )
-                             , title='One Step'
-                             , description='One small step'
-                             )
-
-        steps = registry.listSteps()
-        self.assertEqual( len( steps ), 1 )
-        self.failUnless( 'one' in steps )
-
-        sorted = registry.sortSteps()
-        self.assertEqual( len( sorted ), 1 )
-        self.assertEqual( sorted[ 0 ], 'one' )
-
-        self.assertEqual( registry.getStep( 'one' ), ONE_FUNC )
-
-        info = registry.getStepMetadata( 'one' )
-        self.assertEqual( info[ 'id' ], 'one' )
-        self.assertEqual( info[ 'version' ], '1' )
-        self.assertEqual( info[ 'handler' ], ONE_FUNC_NAME )
-        self.assertEqual( info[ 'dependencies' ], ( 'two', 'three' ) )
-        self.assertEqual( info[ 'title' ], 'One Step' )
-        self.assertEqual( info[ 'description' ], 'One small step' )
-
-        info_list = registry.listStepMetadata()
-        self.assertEqual( len( info_list ), 1 )
-        self.assertEqual( info, info_list[ 0 ] )
-
-    def test_registerStep_conflict( self ):
-
-        registry = self._makeOne()
-
-        registry.registerStep( id='one', version='1', handler=ONE_FUNC )
-
-        self.assertRaises( KeyError
-                         , registry.registerStep
-                         , id='one'
-                         , version='0'
-                         , handler=ONE_FUNC
-                         )
-
-        registry.registerStep( id='one', version='1', handler=ONE_FUNC )
-
-        info_list = registry.listStepMetadata()
-        self.assertEqual( len( info_list ), 1 )
-
-    def test_registerStep_replacement( self ):
-
-        registry = self._makeOne()
-
-        registry.registerStep( id='one'
-                             , version='1'
-                             , handler=ONE_FUNC
-                             , dependencies=( 'two', 'three' )
-                             , title='One Step'
-                             , description='One small step'
-                             )
-
-        registry.registerStep( id='one'
-                             , version='1.1'
-                             , handler=ONE_FUNC
-                             , dependencies=()
-                             , title='Leads to Another'
-                             , description='Another small step'
-                             )
-
-        info = registry.getStepMetadata( 'one' )
-        self.assertEqual( info[ 'id' ], 'one' )
-        self.assertEqual( info[ 'version' ], '1.1' )
-        self.assertEqual( info[ 'dependencies' ], () )
-        self.assertEqual( info[ 'title' ], 'Leads to Another' )
-        self.assertEqual( info[ 'description' ], 'Another small step' )
-
-    def test_registerStep_multiple( self ):
-
-        registry = self._makeOne()
-
-        registry.registerStep( id='one'
-                             , version='1'
-                             , handler=ONE_FUNC
-                             , dependencies=()
-                             )
-
-        registry.registerStep( id='two'
-                             , version='2'
-                             , handler=TWO_FUNC
-                             , dependencies=()
-                             )
-
-        registry.registerStep( id='three'
-                             , version='3'
-                             , handler=THREE_FUNC
-                             , dependencies=()
-                             )
-
-        steps = registry.listSteps()
-        self.assertEqual( len( steps ), 3 )
-        self.failUnless( 'one' in steps )
-        self.failUnless( 'two' in steps )
-        self.failUnless( 'three' in steps )
-
-    def test_sortStep_simple( self ):
-
-        registry = self._makeOne()
-
-        registry.registerStep( id='one'
-                             , version='1'
-                             , handler=ONE_FUNC
-                             , dependencies=( 'two', )
-                             )
-
-        registry.registerStep( id='two'
-                             , version='2'
-                             , handler=TWO_FUNC
-                             , dependencies=()
-                             )
-
-        steps = registry.sortSteps()
-        self.assertEqual( len( steps ), 2 )
-        one = steps.index( 'one' )
-        two = steps.index( 'two' )
-
-        self.failUnless( 0 <= two < one )
-
-    def test_sortStep_chained( self ):
-
-        registry = self._makeOne()
-
-        registry.registerStep( id='one'
-                             , version='1'
-                             , handler=ONE_FUNC
-                             , dependencies=( 'two', )
-                             , title='One small step'
-                             )
-
-        registry.registerStep( id='two'
-                             , version='2'
-                             , handler=TWO_FUNC
-                             , dependencies=( 'three', )
-                             , title='Texas two step'
-                             )
-
-        registry.registerStep( id='three'
-                             , version='3'
-                             , handler=THREE_FUNC
-                             , dependencies=()
-                             , title='Gimme three steps'
-                             )
-
-        steps = registry.sortSteps()
-        self.assertEqual( len( steps ), 3 )
-        one = steps.index( 'one' )
-        two = steps.index( 'two' )
-        three = steps.index( 'three' )
-
-        self.failUnless( 0 <= three < two < one )
-
-    def test_sortStep_complex( self ):
-
-        registry = self._makeOne()
-
-        registry.registerStep( id='one'
-                             , version='1'
-                             , handler=ONE_FUNC
-                             , dependencies=( 'two', )
-                             , title='One small step'
-                             )
-
-        registry.registerStep( id='two'
-                             , version='2'
-                             , handler=TWO_FUNC
-                             , dependencies=( 'four', )
-                             , title='Texas two step'
-                             )
-
-        registry.registerStep( id='three'
-                             , version='3'
-                             , handler=THREE_FUNC
-                             , dependencies=( 'four', )
-                             , title='Gimme three steps'
-                             )
-
-        registry.registerStep( id='four'
-                             , version='4'
-                             , handler=FOUR_FUNC
-                             , dependencies=()
-                             , title='Four step program'
-                             )
-
-        steps = registry.sortSteps()
-        self.assertEqual( len( steps ), 4 )
-        one = steps.index( 'one' )
-        two = steps.index( 'two' )
-        three = steps.index( 'three' )
-        four = steps.index( 'four' )
-
-        self.failUnless( 0 <= four < two < one )
-        self.failUnless( 0 <= four < three )
-
-    def test_sortStep_equivalence( self ):
-
-        registry = self._makeOne()
-
-        registry.registerStep( id='one'
-                             , version='1'
-                             , handler=ONE_FUNC
-                             , dependencies=( 'two', 'three' )
-                             , title='One small step'
-                             )
-
-        registry.registerStep( id='two'
-                             , version='2'
-                             , handler=TWO_FUNC
-                             , dependencies=( 'four', )
-                             , title='Texas two step'
-                             )
-
-        registry.registerStep( id='three'
-                             , version='3'
-                             , handler=THREE_FUNC
-                             , dependencies=( 'four', )
-                             , title='Gimme three steps'
-                             )
-
-        registry.registerStep( id='four'
-                             , version='4'
-                             , handler=FOUR_FUNC
-                             , dependencies=()
-                             , title='Four step program'
-                             )
-
-        steps = registry.sortSteps()
-        self.assertEqual( len( steps ), 4 )
-        one = steps.index( 'one' )
-        two = steps.index( 'two' )
-        three = steps.index( 'three' )
-        four = steps.index( 'four' )
-
-        self.failUnless( 0 <= four < two < one )
-        self.failUnless( 0 <= four < three < one )
-
-    def test_checkComplete_simple( self ):
-
-        registry = self._makeOne()
-
-        registry.registerStep( id='one'
-                             , version='1'
-                             , handler=ONE_FUNC
-                             , dependencies=( 'two', )
-                             )
-
-        incomplete = registry.checkComplete()
-        self.assertEqual( len( incomplete ), 1 )
-        self.failUnless( ( 'one', 'two' ) in incomplete )
-
-        registry.registerStep( id='two'
-                             , version='2'
-                             , handler=TWO_FUNC
-                             , dependencies=()
-                             )
-
-        self.assertEqual( len( registry.checkComplete() ), 0 )
-
-    def test_checkComplete_double( self ):
-
-        registry = self._makeOne()
-
-        registry.registerStep( id='one'
-                             , version='1'
-                             , handler=ONE_FUNC
-                             , dependencies=( 'two', 'three' )
-                             )
-
-        incomplete = registry.checkComplete()
-        self.assertEqual( len( incomplete ), 2 )
-        self.failUnless( ( 'one', 'two' ) in incomplete )
-        self.failUnless( ( 'one', 'three' ) in incomplete )
-
-        registry.registerStep( id='two'
-                             , version='2'
-                             , handler=TWO_FUNC
-                             , dependencies=()
-                             )
-
-        incomplete = registry.checkComplete()
-        self.assertEqual( len( incomplete ), 1 )
-        self.failUnless( ( 'one', 'three' ) in incomplete )
-
-        registry.registerStep( id='three'
-                             , version='3'
-                             , handler=THREE_FUNC
-                             , dependencies=()
-                             )
-
-        self.assertEqual( len( registry.checkComplete() ), 0 )
-
-        registry.registerStep( id='two'
-                             , version='2.1'
-                             , handler=TWO_FUNC
-                             , dependencies=( 'four', )
-                             )
-
-        incomplete = registry.checkComplete()
-        self.assertEqual( len( incomplete ), 1 )
-        self.failUnless( ( 'two', 'four' ) in incomplete )
-
-    def test_generateXML_empty( self ):
-
-        registry = self._makeOne().__of__( self.root )
-
-        xml = registry.generateXML()
-
-        self._compareDOM( registry.generateXML(), _EMPTY_IMPORT_XML )
-
-    def test_generateXML_single( self ):
-
-        registry = self._makeOne().__of__( self.root )
-
-        registry.registerStep( id='one'
-                             , version='1'
-                             , handler=ONE_FUNC
-                             , dependencies=()
-                             , title='One Step'
-                             , description='One small step'
-                             )
-
-        self._compareDOM( registry.generateXML(), _SINGLE_IMPORT_XML )
-
-    def test_generateXML_ordered( self ):
-
-        registry = self._makeOne().__of__( self.root )
-
-        registry.registerStep( id='one'
-                             , version='1'
-                             , handler=ONE_FUNC
-                             , dependencies=( 'two', )
-                             , title='One Step'
-                             , description='One small step'
-                             )
-
-        registry.registerStep( id='two'
-                             , version='2'
-                             , handler=TWO_FUNC
-                             , dependencies=( 'three', )
-                             , title='Two Steps'
-                             , description='Texas two step'
-                             )
-
-        registry.registerStep( id='three'
-                             , version='3'
-                             , handler=THREE_FUNC
-                             , dependencies=()
-                             , title='Three Steps'
-                             , description='Gimme three steps'
-                             )
-
-        self._compareDOM( registry.generateXML(), _ORDERED_IMPORT_XML )
-
-    def test_parseXML_empty( self ):
-
-        registry = self._makeOne().__of__( self.root )
-
-        registry.registerStep( id='one'
-                             , version='1'
-                             , handler=ONE_FUNC
-                             , dependencies=()
-                             , description='One small step'
-                             )
-
-        info_list = registry.parseXML( _EMPTY_IMPORT_XML )
-
-        self.assertEqual( len( info_list ), 0 )
-
-    def test_parseXML_single( self ):
-
-        registry = self._makeOne().__of__( self.root )
-
-        registry.registerStep( id='two'
-                             , version='2'
-                             , handler=TWO_FUNC
-                             , dependencies=()
-                             , title='Two Steps'
-                             , description='Texas two step'
-                             )
-
-        info_list = registry.parseXML( _SINGLE_IMPORT_XML )
-
-        self.assertEqual( len( info_list ), 1 )
-
-        info = info_list[ 0 ]
-        self.assertEqual( info[ 'id' ], 'one' )
-        self.assertEqual( info[ 'version' ], '1' )
-        self.assertEqual( info[ 'handler' ], ONE_FUNC_NAME )
-        self.assertEqual( info[ 'dependencies' ], () )
-        self.assertEqual( info[ 'title' ], 'One Step' )
-        self.failUnless( 'One small step' in info[ 'description' ] )
-
-
-_EMPTY_IMPORT_XML = """\
-<?xml version="1.0"?>
-<import-steps>
-</import-steps>
-"""
-
-_SINGLE_IMPORT_XML = """\
-<?xml version="1.0"?>
-<import-steps>
- <import-step id="one"
-             version="1"
-             handler="%s"
-             title="One Step">
-  One small step
- </import-step>
-</import-steps>
-""" % ( ONE_FUNC_NAME, )
-
-_ORDERED_IMPORT_XML = """\
-<?xml version="1.0"?>
-<import-steps>
- <import-step id="one"
-             version="1"
-             handler="%s"
-             title="One Step">
-  <dependency step="two" />
-  One small step
- </import-step>
- <import-step id="three"
-             version="3"
-             handler="%s"
-             title="Three Steps">
-  Gimme three steps
- </import-step>
- <import-step id="two"
-             version="2"
-             handler="%s"
-             title="Two Steps">
-  <dependency step="three" />
-  Texas two step
- </import-step>
-</import-steps>
-""" % ( ONE_FUNC_NAME, THREE_FUNC_NAME, TWO_FUNC_NAME )
-
-
-#==============================================================================
-#   ESR tests
-#==============================================================================
-class ExportStepRegistryTests( BaseRegistryTests
-                             , ConformsToIStepRegistry
-                             , ConformsToIExportStepRegistry
-                             ):
-
-    def _getTargetClass( self ):
-
-        from Products.CMFSetup.registry import ExportStepRegistry
-        return ExportStepRegistry
-
-    def _makeOne( self, *args, **kw ):
-
-        return self._getTargetClass()( *args, **kw )
-
-    def test_empty( self ):
-
-        registry = self._makeOne()
-        self.assertEqual( len( registry.listSteps() ), 0 )
-        self.assertEqual( len( registry.listStepMetadata() ), 0 )
-
-    def test_getStep_nonesuch( self ):
-
-        registry = self._makeOne()
-        self.assertEqual( registry.getStep( 'nonesuch' ), None )
-
-    def test_getStep_defaulted( self ):
-
-        registry = self._makeOne()
-        default = lambda x: false
-        self.assertEqual( registry.getStep( 'nonesuch', default ), default )
-
-    def test_getStepMetadata_nonesuch( self ):
-
-        registry = self._makeOne()
-        self.assertEqual( registry.getStepMetadata( 'nonesuch' ), None )
-
-    def test_getStepMetadata_defaulted( self ):
-
-        registry = self._makeOne()
-        self.assertEqual( registry.getStepMetadata( 'nonesuch', {} ), {} )
-
-    def test_registerStep_simple( self ):
-
-        registry = self._makeOne()
-        registry.registerStep( 'one', ONE_FUNC )
-        info = registry.getStepMetadata( 'one', {} )
-
-        self.assertEqual( info[ 'id' ], 'one' )
-        self.assertEqual( info[ 'handler' ], ONE_FUNC_NAME )
-        self.assertEqual( info[ 'title' ], 'one' )
-        self.assertEqual( info[ 'description' ], '' )
-
-    def test_registerStep_docstring( self ):
-
-        def func_with_doc( site ):
-            """This is the first line.
-
-            This is the second line.
-            """
-        FUNC_NAME = '%s.%s' % ( __name__, func_with_doc.__name__ )
-
-        registry = self._makeOne()
-        registry.registerStep( 'one', func_with_doc )
-        info = registry.getStepMetadata( 'one', {} )
-
-        self.assertEqual( info[ 'id' ], 'one' )
-        self.assertEqual( info[ 'handler' ], FUNC_NAME )
-        self.assertEqual( info[ 'title' ], 'This is the first line.' )
-        self.assertEqual( info[ 'description' ] , 'This is the second line.' )
-
-    def test_registerStep_docstring_with_override( self ):
-
-        def func_with_doc( site ):
-            """This is the first line.
-
-            This is the second line.
-            """
-        FUNC_NAME = '%s.%s' % ( __name__, func_with_doc.__name__ )
-
-        registry = self._makeOne()
-        registry.registerStep( 'one', func_with_doc
-                               , description='Description' )
-        info = registry.getStepMetadata( 'one', {} )
-
-        self.assertEqual( info[ 'id' ], 'one' )
-        self.assertEqual( info[ 'handler' ], FUNC_NAME )
-        self.assertEqual( info[ 'title' ], 'This is the first line.' )
-        self.assertEqual( info[ 'description' ], 'Description' )
-
-    def test_registerStep_collision( self ):
-
-        registry = self._makeOne()
-        registry.registerStep( 'one', ONE_FUNC )
-        registry.registerStep( 'one', TWO_FUNC )
-        info = registry.getStepMetadata( 'one', {} )
-
-        self.assertEqual( info[ 'id' ], 'one' )
-        self.assertEqual( info[ 'handler' ], TWO_FUNC_NAME )
-        self.assertEqual( info[ 'title' ], 'one' )
-        self.assertEqual( info[ 'description' ], '' )
-
-    def test_generateXML_empty( self ):
-
-        registry = self._makeOne().__of__( self.root )
-
-        xml = registry.generateXML()
-
-        self._compareDOM( registry.generateXML(), _EMPTY_EXPORT_XML )
-
-    def test_generateXML_single( self ):
-
-        registry = self._makeOne().__of__( self.root )
-
-        registry.registerStep( id='one'
-                             , handler=ONE_FUNC
-                             , title='One Step'
-                             , description='One small step'
-                             )
-
-        self._compareDOM( registry.generateXML(), _SINGLE_EXPORT_XML )
-
-    def test_generateXML_ordered( self ):
-
-        registry = self._makeOne().__of__( self.root )
-
-        registry.registerStep( id='one'
-                             , handler=ONE_FUNC
-                             , title='One Step'
-                             , description='One small step'
-                             )
-
-        registry.registerStep( id='two'
-                             , handler=TWO_FUNC
-                             , title='Two Steps'
-                             , description='Texas two step'
-                             )
-
-        registry.registerStep( id='three'
-                             , handler=THREE_FUNC
-                             , title='Three Steps'
-                             , description='Gimme three steps'
-                             )
-
-        self._compareDOM( registry.generateXML(), _ORDERED_EXPORT_XML )
-
-    def test_parseXML_empty( self ):
-
-        registry = self._makeOne().__of__( self.root )
-
-        registry.registerStep( id='one'
-                             , handler=ONE_FUNC
-                             , description='One small step'
-                             )
-
-        info_list = registry.parseXML( _EMPTY_EXPORT_XML )
-
-        self.assertEqual( len( info_list ), 0 )
-
-    def test_parseXML_single( self ):
-
-        registry = self._makeOne().__of__( self.root )
-
-        registry.registerStep( id='two'
-                             , handler=TWO_FUNC
-                             , title='Two Steps'
-                             , description='Texas two step'
-                             )
-
-        info_list = registry.parseXML( _SINGLE_EXPORT_XML )
-
-        self.assertEqual( len( info_list ), 1 )
-
-        info = info_list[ 0 ]
-        self.assertEqual( info[ 'id' ], 'one' )
-        self.assertEqual( info[ 'handler' ], ONE_FUNC_NAME )
-        self.assertEqual( info[ 'title' ], 'One Step' )
-        self.failUnless( 'One small step' in info[ 'description' ] )
-
-    def test_parseXML_single_as_ascii( self ):
-
-        registry = self._makeOne().__of__( self.root )
-
-        registry.registerStep( id='two'
-                             , handler=TWO_FUNC
-                             , title='Two Steps'
-                             , description='Texas two step'
-                             )
-
-        info_list = registry.parseXML( _SINGLE_EXPORT_XML, encoding='ascii' )
-
-        self.assertEqual( len( info_list ), 1 )
-
-        info = info_list[ 0 ]
-        self.assertEqual( info[ 'id' ], 'one' )
-        self.assertEqual( info[ 'handler' ], ONE_FUNC_NAME )
-        self.assertEqual( info[ 'title' ], 'One Step' )
-        self.failUnless( 'One small step' in info[ 'description' ] )
-
-
-_EMPTY_EXPORT_XML = """\
-<?xml version="1.0"?>
-<export-steps>
-</export-steps>
-"""
-
-_SINGLE_EXPORT_XML = """\
-<?xml version="1.0"?>
-<export-steps>
- <export-step id="one"
-                handler="%s"
-                title="One Step">
-  One small step
- </export-step>
-</export-steps>
-""" % ( ONE_FUNC_NAME, )
-
-_ORDERED_EXPORT_XML = """\
-<?xml version="1.0"?>
-<export-steps>
- <export-step id="one"
-                handler="%s"
-                title="One Step">
-  One small step
- </export-step>
- <export-step id="three"
-                handler="%s"
-                title="Three Steps">
-  Gimme three steps
- </export-step>
- <export-step id="two"
-                handler="%s"
-                title="Two Steps">
-  Texas two step
- </export-step>
-</export-steps>
-""" % ( ONE_FUNC_NAME, THREE_FUNC_NAME, TWO_FUNC_NAME )
-
-#==============================================================================
-#   ToolsetRegistry tests
-#==============================================================================
-class ToolsetRegistryTests( BaseRegistryTests
-                          , ConformsToIToolsetRegistry
-                          ):
-
-    def _getTargetClass( self ):
-
-        from Products.CMFSetup.registry import ToolsetRegistry
-        return ToolsetRegistry
-
-    def _initSite( self ):
-
-        self.root.site = Folder( id='site' )
-        site = self.root.site
-
-        return site
-
-    def test_empty( self ):
-
-        site = self._initSite()
-        configurator = self._makeOne().__of__( site )
-
-        self.assertEqual( len( configurator.listForbiddenTools() ), 0 )
-        self.assertEqual( len( configurator.listRequiredTools() ), 0 )
-        self.assertEqual( len( configurator.listRequiredToolInfo() ), 0 )
-
-        self.assertRaises( KeyError
-                         , configurator.getRequiredToolInfo, 'nonesuch' )
-
-    def test_addForbiddenTool_multiple( self ):
-
-        VERBOTTEN = ( 'foo', 'bar', 'bam' )
-
-        site = self._initSite()
-        configurator = self._makeOne().__of__( site )
-
-        for verbotten in VERBOTTEN:
-            configurator.addForbiddenTool( verbotten )
-
-        self.assertEqual( len( configurator.listForbiddenTools() )
-                        , len( VERBOTTEN ) )
-
-        for verbotten in configurator.listForbiddenTools():
-            self.failUnless( verbotten in VERBOTTEN )
-
-    def test_addForbiddenTool_duplicate( self ):
-
-        site = self._initSite()
-        configurator = self._makeOne().__of__( site )
-
-        configurator.addForbiddenTool( 'once' )
-        configurator.addForbiddenTool( 'once' )
-
-        self.assertEqual( len( configurator.listForbiddenTools() ), 1 )
-
-    def test_addForbiddenTool_but_required( self ):
-
-        site = self._initSite()
-        configurator = self._makeOne().__of__( site )
-
-        configurator.addRequiredTool( 'required', 'some.dotted.name' )
-
-        self.assertRaises( ValueError
-                         , configurator.addForbiddenTool, 'required' )
-
-    def test_addRequiredTool_multiple( self ):
-
-        REQUIRED = ( ( 'one', 'path.to.one' )
-                   , ( 'two', 'path.to.two' )
-                   , ( 'three', 'path.to.three' )
-                   )
-
-        site = self._initSite()
-        configurator = self._makeOne().__of__( site )
-
-        for tool_id, dotted_name in REQUIRED:
-            configurator.addRequiredTool( tool_id, dotted_name )
-
-        self.assertEqual( len( configurator.listRequiredTools() )
-                        , len( REQUIRED ) )
-
-        for id in [ x[0] for x in REQUIRED ]:
-            self.failUnless( id in configurator.listRequiredTools() )
-
-        self.assertEqual( len( configurator.listRequiredToolInfo() )
-                        , len( REQUIRED ) )
-
-        for tool_id, dotted_name in REQUIRED:
-            info = configurator.getRequiredToolInfo( tool_id )
-            self.assertEqual( info[ 'id' ], tool_id )
-            self.assertEqual( info[ 'class' ], dotted_name )
-
-    def test_addRequiredTool_duplicate( self ):
-
-        site = self._initSite()
-        configurator = self._makeOne().__of__( site )
-
-        configurator.addRequiredTool( 'required', 'some.dotted.name' )
-        configurator.addRequiredTool( 'required', 'another.name' )
-
-        info = configurator.getRequiredToolInfo( 'required' )
-        self.assertEqual( info[ 'id' ], 'required' )
-        self.assertEqual( info[ 'class' ], 'another.name' )
-
-    def test_addRequiredTool_but_forbidden( self ):
-
-        site = self._initSite()
-        configurator = self._makeOne().__of__( site )
-
-        configurator.addForbiddenTool( 'forbidden' )
-
-        self.assertRaises( ValueError
-                         , configurator.addRequiredTool
-                         , 'forbidden'
-                         , 'a.name'
-                         )
-
-    def test_generateXML_empty( self ):
-
-        site = self._initSite()
-        configurator = self._makeOne().__of__( site )
-
-        self._compareDOM( configurator.generateXML(), _EMPTY_TOOLSET_XML )
-
-    def test_generateXML_normal( self ):
-
-        site = self._initSite()
-        configurator = self._makeOne().__of__( site )
-
-        configurator.addForbiddenTool( 'doomed' )
-        configurator.addRequiredTool( 'mandatory', 'path.to.one' )
-        configurator.addRequiredTool( 'obligatory', 'path.to.another' )
-
-        configurator.parseXML( _NORMAL_TOOLSET_XML )
-
-    def test_parseXML_empty( self ):
-
-        site = self._initSite()
-        configurator = self._makeOne().__of__( site )
-
-        configurator.parseXML( _EMPTY_TOOLSET_XML )
-
-        self.assertEqual( len( configurator.listForbiddenTools() ), 0 )
-        self.assertEqual( len( configurator.listRequiredTools() ), 0 )
-
-    def test_parseXML_normal( self ):
-
-        site = self._initSite()
-        configurator = self._makeOne().__of__( site )
-
-        configurator.parseXML( _NORMAL_TOOLSET_XML )
-
-        self.assertEqual( len( configurator.listForbiddenTools() ), 1 )
-        self.failUnless( 'doomed' in configurator.listForbiddenTools() )
-
-        self.assertEqual( len( configurator.listRequiredTools() ), 2 )
-
-        self.failUnless( 'mandatory' in configurator.listRequiredTools() )
-        info = configurator.getRequiredToolInfo( 'mandatory' )
-        self.assertEqual( info[ 'class' ], 'path.to.one' )
-
-        self.failUnless( 'obligatory' in configurator.listRequiredTools() )
-        info = configurator.getRequiredToolInfo( 'obligatory' )
-        self.assertEqual( info[ 'class' ], 'path.to.another' )
-
-    def test_parseXML_confused( self ):
-
-        site = self._initSite()
-        configurator = self._makeOne().__of__( site )
-
-        self.assertRaises( ValueError
-                         , configurator.parseXML, _CONFUSED_TOOLSET_XML )
-
-
-_EMPTY_TOOLSET_XML = """\
-<?xml version="1.0"?>
-<tool-setup>
-</tool-setup>
-"""
-
-_NORMAL_TOOLSET_XML = """\
-<?xml version="1.0"?>
-<tool-setup>
- <forbidden tool_id="doomed" />
- <required tool_id="mandatory" class="path.to.one" />
- <required tool_id="obligatory" class="path.to.another" />
-</tool-setup>
-"""
-
-_CONFUSED_TOOLSET_XML = """\
-<?xml version="1.0"?>
-<tool-setup>
- <forbidden tool_id="confused" />
- <required tool_id="confused" class="path.to.one" />
-</tool-setup>
-"""
-
-class ProfileRegistryTests( BaseRegistryTests
-                          , ConformsToIProfileRegistry
-                          ):
-
-    def _getTargetClass( self ):
-
-        from Products.CMFSetup.registry import ProfileRegistry
-        return ProfileRegistry
-
-    def test_empty( self ):
-
-        registry = self._makeOne()
-
-        self.assertEqual( len( registry.listProfiles() ), 0 )
-        self.assertEqual( len( registry.listProfiles() ), 0 )
-        self.assertRaises( KeyError, registry.getProfileInfo, 'nonesuch' )
-
-    def test_registerProfile_normal( self ):
-
-        NAME = 'one'
-        TITLE = 'One'
-        DESCRIPTION = 'One profile'
-        PATH = '/path/to/one'
-        PRODUCT = 'TestProduct'
-        PROFILE_TYPE = EXTENSION
-        PROFILE_ID = 'TestProduct:one'
-
-        registry = self._makeOne()
-        registry.registerProfile( NAME
-                                , TITLE
-                                , DESCRIPTION
-                                , PATH
-                                , PRODUCT
-                                , PROFILE_TYPE
-                                )
-
-        self.assertEqual( len( registry.listProfiles() ), 1 )
-        self.assertEqual( len( registry.listProfileInfo() ), 1 )
-
-        info = registry.getProfileInfo( PROFILE_ID )
-
-        self.assertEqual( info[ 'id' ], PROFILE_ID )
-        self.assertEqual( info[ 'title' ], TITLE )
-        self.assertEqual( info[ 'description' ], DESCRIPTION )
-        self.assertEqual( info[ 'path' ], PATH )
-        self.assertEqual( info[ 'product' ], PRODUCT )
-        self.assertEqual( info[ 'type' ], PROFILE_TYPE )
-
-    def test_registerProfile_duplicate( self ):
-
-        PROFILE_ID = 'one'
-        TITLE = 'One'
-        DESCRIPTION = 'One profile'
-        PATH = '/path/to/one'
-
-        registry = self._makeOne()
-        registry.registerProfile( PROFILE_ID, TITLE, DESCRIPTION, PATH )
-        self.assertRaises( KeyError
-                         , registry.registerProfile
-                         , PROFILE_ID, TITLE, DESCRIPTION, PATH )
-
-
-def test_suite():
-    return unittest.TestSuite((
-        unittest.makeSuite( ImportStepRegistryTests ),
-        unittest.makeSuite( ExportStepRegistryTests ),
-        unittest.makeSuite( ToolsetRegistryTests ),
-        unittest.makeSuite( ProfileRegistryTests ),
-        ))
-
-if __name__ == '__main__':
-    unittest.main(defaultTest='test_suite')

Deleted: CMF/trunk/CMFSetup/tests/test_rolemap.py
===================================================================
--- CMF/trunk/CMFSetup/tests/test_rolemap.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFSetup/tests/test_rolemap.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -1,784 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004 Zope Corporation and Contributors. All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-""" CMFSetup rolemap export / import unit tests
-
-$Id$
-"""
-
-import unittest
-import Testing
-import Zope2
-Zope2.startup()
-
-from OFS.Folder import Folder
-
-from common import BaseRegistryTests
-from common import DummyExportContext
-from common import DummyImportContext
-
-class RolemapConfiguratorTests( BaseRegistryTests ):
-
-    def _getTargetClass( self ):
-
-        from Products.CMFSetup.rolemap import RolemapConfigurator
-        return RolemapConfigurator
-
-    def test_listRoles_normal( self ):
-
-        EXPECTED = [ 'Anonymous', 'Authenticated', 'Manager', 'Owner' ]
-        self.root.site = Folder( id='site' )
-        site = self.root.site
-        configurator = self._makeOne( site )
-
-        roles = list( configurator.listRoles() )
-        self.assertEqual( len( roles ), len( EXPECTED ) )
-
-        roles.sort()
-
-        for found, expected in zip( roles, EXPECTED ):
-            self.assertEqual( found, expected )
-
-    def test_listRoles_added( self ):
-
-        EXPECTED = [ 'Anonymous', 'Authenticated', 'Manager', 'Owner', 'ZZZ' ]
-        self.root.site = Folder( id='site' )
-        site = self.root.site
-        existing_roles = list( getattr( site, '__ac_roles__', [] ) )[:]
-        existing_roles.append( 'ZZZ' )
-        site.__ac_roles__ = existing_roles
-
-        configurator = self._makeOne( site )
-
-        roles = list( configurator.listRoles() )
-        self.assertEqual( len( roles ), len( EXPECTED ) )
-
-        roles.sort()
-
-        for found, expected in zip( roles, EXPECTED ):
-            self.assertEqual( found, expected )
-
-    def test_listPermissions_nooverrides( self ):
-
-        self.root.site = Folder( id='site' )
-        site = self.root.site
-        configurator = self._makeOne( site )
-
-        self.assertEqual( len( configurator.listPermissions() ), 0 )
-
-    def test_listPermissions_nooverrides( self ):
-
-        site = Folder( id='site' ).__of__( self.root )
-        configurator = self._makeOne( site )
-
-        self.assertEqual( len( configurator.listPermissions() ), 0 )
-
-    def test_listPermissions_acquire( self ):
-
-        ACI = 'Access contents information'
-        ROLES = [ 'Manager', 'Owner' ]
-
-        site = Folder( id='site' ).__of__( self.root )
-        site.manage_permission( ACI, ROLES, acquire=1 )
-        configurator = self._makeOne( site )
-
-        self.assertEqual( len( configurator.listPermissions() ), 1 )
-        info = configurator.listPermissions()[ 0 ]
-        self.assertEqual( info[ 'name' ], ACI )
-        self.assertEqual( info[ 'roles' ], ROLES )
-        self.failUnless( info[ 'acquire' ] )
-
-    def test_listPermissions_no_acquire( self ):
-
-        ACI = 'Access contents information'
-        ROLES = [ 'Manager', 'Owner' ]
-
-        site = Folder( id='site' ).__of__( self.root )
-        site.manage_permission( ACI, ROLES )
-        configurator = self._makeOne( site )
-
-        self.assertEqual( len( configurator.listPermissions() ), 1 )
-        info = configurator.listPermissions()[ 0 ]
-        self.assertEqual( info[ 'name' ], ACI )
-        self.assertEqual( info[ 'roles' ], ROLES )
-        self.failIf( info[ 'acquire' ] )
-
-    def test_generateXML_empty( self ):
-
-        self.root.site = Folder( id='site' )
-        site = self.root.site
-        configurator = self._makeOne( site ).__of__( site )
-
-        self._compareDOM( configurator.generateXML(), _EMPTY_EXPORT )
-
-    def test_generateXML_added_role( self ):
-
-        self.root.site = Folder( id='site' )
-        site = self.root.site
-        existing_roles = list( getattr( site, '__ac_roles__', [] ) )[:]
-        existing_roles.append( 'ZZZ' )
-        site.__ac_roles__ = existing_roles
-        configurator = self._makeOne( site ).__of__( site )
-
-        self._compareDOM( configurator.generateXML(), _ADDED_ROLE_EXPORT )
-
-    def test_generateEXML_acquired_perm( self ):
-
-        ACI = 'Access contents information'
-        ROLES = [ 'Manager', 'Owner' ]
-
-        site = Folder( id='site' ).__of__( self.root )
-        site.manage_permission( ACI, ROLES, acquire=1 )
-        configurator = self._makeOne( site ).__of__( site )
-
-        self._compareDOM( configurator.generateXML(), _ACQUIRED_EXPORT )
-
-    def test_generateEXML_unacquired_perm( self ):
-
-        ACI = 'Access contents information'
-        ROLES = [ 'Manager', 'Owner', 'ZZZ' ]
-
-        site = Folder( id='site' ).__of__( self.root )
-        existing_roles = list( getattr( site, '__ac_roles__', [] ) )[:]
-        existing_roles.append( 'ZZZ' )
-        site.__ac_roles__ = existing_roles
-        site.manage_permission( ACI, ROLES )
-        configurator = self._makeOne( site ).__of__( site )
-
-        self._compareDOM( configurator.generateXML(), _COMBINED_EXPORT )
-
-    def test_generateEXML_unacquired_perm_added_role( self ):
-
-        ACI = 'Access contents information'
-        ROLES = [ 'Manager', 'Owner' ]
-
-        site = Folder( id='site' ).__of__( self.root )
-        site.manage_permission( ACI, ROLES )
-        configurator = self._makeOne( site ).__of__( site )
-
-        self._compareDOM( configurator.generateXML(), _UNACQUIRED_EXPORT )
-
-    def test_parseXML_empty( self ):
-
-        self.root.site = Folder( id='site' )
-        site = self.root.site
-        existing_roles = list( getattr( site, '__ac_roles__', [] ) )[:]
-        configurator = self._makeOne( site )
-
-        rolemap_info = configurator.parseXML( _EMPTY_EXPORT )
-
-        self.assertEqual( len( rolemap_info[ 'roles' ] ), 4 )
-        self.assertEqual( len( rolemap_info[ 'permissions' ] ), 0 )
-
-    def test_parseXML_added_role( self ):
-
-        self.root.site = Folder( id='site' )
-        site = self.root.site
-        configurator = self._makeOne( site )
-
-        rolemap_info = configurator.parseXML( _ADDED_ROLE_EXPORT )
-        roles = rolemap_info[ 'roles' ]
-
-        self.assertEqual( len( roles ), 5 )
-        self.failUnless( 'Anonymous' in roles )
-        self.failUnless( 'Authenticated' in roles )
-        self.failUnless( 'Manager' in roles )
-        self.failUnless( 'Owner' in roles )
-        self.failUnless( 'ZZZ' in roles )
-
-    def test_parseXML_acquired_permission( self ):
-
-        ACI = 'Access contents information'
-
-        self.root.site = Folder( id='site' )
-        site = self.root.site
-        configurator = self._makeOne( site )
-
-        rolemap_info = configurator.parseXML( _ACQUIRED_EXPORT )
-
-        self.assertEqual( len( rolemap_info[ 'permissions' ] ), 1 )
-        permission = rolemap_info[ 'permissions' ][ 0 ]
-
-        self.assertEqual( permission[ 'name' ], ACI )
-        self.failUnless( permission[ 'acquire' ] )
-
-        p_roles = permission[ 'roles' ]
-        self.assertEqual( len( p_roles ), 2 )
-        self.failUnless( 'Manager' in p_roles )
-        self.failUnless( 'Owner' in p_roles )
-
-    def test_parseXML_unacquired_permission( self ):
-
-        ACI = 'Access contents information'
-
-        self.root.site = Folder( id='site' )
-        site = self.root.site
-        configurator = self._makeOne( site )
-
-        rolemap_info = configurator.parseXML( _UNACQUIRED_EXPORT )
-
-        self.assertEqual( len( rolemap_info[ 'permissions' ] ), 1 )
-        permission = rolemap_info[ 'permissions' ][ 0 ]
-
-        self.assertEqual( permission[ 'name' ], ACI )
-        self.failIf( permission[ 'acquire' ] )
-
-        p_roles = permission[ 'roles' ]
-        self.assertEqual( len( p_roles ), 2 )
-        self.failUnless( 'Manager' in p_roles )
-        self.failUnless( 'Owner' in p_roles )
-
-    def test_parseXML_unacquired_permission_added_role( self ):
-
-        ACI = 'Access contents information'
-
-        self.root.site = Folder( id='site' )
-        site = self.root.site
-        configurator = self._makeOne( site )
-
-        rolemap_info = configurator.parseXML( _COMBINED_EXPORT )
-        roles = rolemap_info[ 'roles' ]
-
-        self.assertEqual( len( roles ), 5 )
-        self.failUnless( 'Anonymous' in roles )
-        self.failUnless( 'Authenticated' in roles )
-        self.failUnless( 'Manager' in roles )
-        self.failUnless( 'Owner' in roles )
-        self.failUnless( 'ZZZ' in roles )
-
-        self.assertEqual( len( rolemap_info[ 'permissions' ] ), 1 )
-        permission = rolemap_info[ 'permissions' ][ 0 ]
-
-        self.assertEqual( permission[ 'name' ], ACI )
-        self.failIf( permission[ 'acquire' ] )
-
-        p_roles = permission[ 'roles' ]
-        self.assertEqual( len( p_roles ), 3 )
-        self.failUnless( 'Manager' in p_roles )
-        self.failUnless( 'Owner' in p_roles )
-        self.failUnless( 'ZZZ' in p_roles )
-
-
-
-_EMPTY_EXPORT = """\
-<?xml version="1.0"?>
-<rolemap>
-  <roles>
-    <role name="Anonymous"/>
-    <role name="Authenticated"/>
-    <role name="Manager"/>
-    <role name="Owner"/>
-  </roles>
-  <permissions>
-  </permissions>
-</rolemap>
-"""
-
-_ADDED_ROLE_EXPORT = """\
-<?xml version="1.0"?>
-<rolemap>
-  <roles>
-    <role name="Anonymous"/>
-    <role name="Authenticated"/>
-    <role name="Manager"/>
-    <role name="Owner"/>
-    <role name="ZZZ"/>
-  </roles>
-  <permissions>
-  </permissions>
-</rolemap>
-"""
-
-_ACQUIRED_EXPORT = """\
-<?xml version="1.0"?>
-<rolemap>
-  <roles>
-    <role name="Anonymous"/>
-    <role name="Authenticated"/>
-    <role name="Manager"/>
-    <role name="Owner"/>
-  </roles>
-  <permissions>
-    <permission name="Access contents information"
-                acquire="True">
-      <role name="Manager"/>
-      <role name="Owner"/>
-    </permission>
-  </permissions>
-</rolemap>
-"""
-
-_UNACQUIRED_EXPORT = """\
-<?xml version="1.0"?>
-<rolemap>
-  <roles>
-    <role name="Anonymous"/>
-    <role name="Authenticated"/>
-    <role name="Manager"/>
-    <role name="Owner"/>
-  </roles>
-  <permissions>
-    <permission name="Access contents information"
-                acquire="False">
-      <role name="Manager"/>
-      <role name="Owner"/>
-    </permission>
-  </permissions>
-</rolemap>
-"""
-
-_COMBINED_EXPORT = """\
-<?xml version="1.0"?>
-<rolemap>
-  <roles>
-    <role name="Anonymous"/>
-    <role name="Authenticated"/>
-    <role name="Manager"/>
-    <role name="Owner"/>
-    <role name="ZZZ"/>
-  </roles>
-  <permissions>
-    <permission name="Access contents information"
-                acquire="False">
-      <role name="Manager"/>
-      <role name="Owner"/>
-      <role name="ZZZ"/>
-    </permission>
-  </permissions>
-</rolemap>
-"""
-
-class Test_exportRolemap( BaseRegistryTests ):
-
-    def test_unchanged( self ):
-
-        self.root.site = Folder( 'site' )
-        site = self.root.site
-
-        context = DummyExportContext( site )
-
-        from Products.CMFSetup.rolemap import exportRolemap
-        exportRolemap( context )
-
-        self.assertEqual( len( context._wrote ), 1 )
-        filename, text, content_type = context._wrote[ 0 ]
-        self.assertEqual( filename, 'rolemap.xml' )
-        self._compareDOM( text, _EMPTY_EXPORT )
-        self.assertEqual( content_type, 'text/xml' )
-
-    def test_added_role( self ):
-
-        self.root.site = Folder( 'site' )
-        site = self.root.site
-        existing_roles = list( getattr( site, '__ac_roles__', [] ) )[:]
-        existing_roles.append( 'ZZZ' )
-        site.__ac_roles__ = existing_roles
-
-        context = DummyExportContext( site )
-
-        from Products.CMFSetup.rolemap import exportRolemap
-        exportRolemap( context )
-
-        self.assertEqual( len( context._wrote ), 1 )
-        filename, text, content_type = context._wrote[ 0 ]
-        self.assertEqual( filename, 'rolemap.xml' )
-        self._compareDOM( text, _ADDED_ROLE_EXPORT )
-        self.assertEqual( content_type, 'text/xml' )
-
-
-    def test_acquired_perm( self ):
-
-        ACI = 'Access contents information'
-        ROLES = [ 'Manager', 'Owner' ]
-
-        self.root.site = Folder( 'site' )
-        site = self.root.site
-        site.manage_permission( ACI, ROLES, acquire=1 )
-
-        context = DummyExportContext( site )
-
-        from Products.CMFSetup.rolemap import exportRolemap
-        exportRolemap( context )
-
-        self.assertEqual( len( context._wrote ), 1 )
-        filename, text, content_type = context._wrote[ 0 ]
-        self.assertEqual( filename, 'rolemap.xml' )
-        self._compareDOM( text, _ACQUIRED_EXPORT )
-        self.assertEqual( content_type, 'text/xml' )
-
-    def test_unacquired_perm( self ):
-
-        ACI = 'Access contents information'
-        ROLES = [ 'Manager', 'Owner', 'ZZZ' ]
-
-        self.root.site = Folder( 'site' )
-        site = self.root.site
-        existing_roles = list( getattr( site, '__ac_roles__', [] ) )[:]
-        existing_roles.append( 'ZZZ' )
-        site.__ac_roles__ = existing_roles
-        site.manage_permission( ACI, ROLES )
-
-        context = DummyExportContext( site )
-
-        from Products.CMFSetup.rolemap import exportRolemap
-        exportRolemap( context )
-
-        self.assertEqual( len( context._wrote ), 1 )
-        filename, text, content_type = context._wrote[ 0 ]
-        self.assertEqual( filename, 'rolemap.xml' )
-        self._compareDOM( text, _COMBINED_EXPORT )
-        self.assertEqual( content_type, 'text/xml' )
-
-    def test_unacquired_perm_added_role( self ):
-
-        ACI = 'Access contents information'
-        ROLES = [ 'Manager', 'Owner' ]
-
-        self.root.site = Folder( 'site' )
-        site = self.root.site
-        site.manage_permission( ACI, ROLES )
-
-        context = DummyExportContext( site )
-
-        from Products.CMFSetup.rolemap import exportRolemap
-        exportRolemap( context )
-
-        self.assertEqual( len( context._wrote ), 1 )
-        filename, text, content_type = context._wrote[ 0 ]
-        self.assertEqual( filename, 'rolemap.xml' )
-        self._compareDOM( text, _UNACQUIRED_EXPORT )
-        self.assertEqual( content_type, 'text/xml' )
-
-class Test_importRolemap( BaseRegistryTests ):
-
-    def test_empty_default_purge( self ):
-
-        self.root.site = Folder( id='site' )
-        site = self.root.site
-        original_roles = list( getattr( site, '__ac_roles__', [] ) )[:]
-        modified_roles = original_roles[:]
-        modified_roles.append( 'ZZZ' )
-        site.__ac_roles__ = modified_roles
-
-        context = DummyImportContext( site )
-        context._files[ 'rolemap.xml' ] = _EMPTY_EXPORT
-
-        from Products.CMFSetup.rolemap import importRolemap
-        importRolemap( context )
-
-        new_roles = list( getattr( site, '__ac_roles__', [] ) )[:]
-
-        original_roles.sort()
-        new_roles.sort()
-
-        self.assertEqual( original_roles, new_roles )
-
-    def test_empty_explicit_purge( self ):
-
-        self.root.site = Folder( id='site' )
-        site = self.root.site
-        original_roles = list( getattr( site, '__ac_roles__', [] ) )[:]
-        modified_roles = original_roles[:]
-        modified_roles.append( 'ZZZ' )
-        site.__ac_roles__ = modified_roles
-
-        context = DummyImportContext( site, True )
-        context._files[ 'rolemap.xml' ] = _EMPTY_EXPORT
-
-        from Products.CMFSetup.rolemap import importRolemap
-        importRolemap( context )
-
-        new_roles = list( getattr( site, '__ac_roles__', [] ) )[:]
-
-        original_roles.sort()
-        new_roles.sort()
-
-        self.assertEqual( original_roles, new_roles )
-
-    def test_empty_skip_purge( self ):
-
-        self.root.site = Folder( id='site' )
-        site = self.root.site
-        original_roles = list( getattr( site, '__ac_roles__', [] ) )[:]
-        modified_roles = original_roles[:]
-        modified_roles.append( 'ZZZ' )
-        site.__ac_roles__ = modified_roles
-
-        context = DummyImportContext( site, False )
-        context._files[ 'rolemap.xml' ] = _EMPTY_EXPORT
-
-        from Products.CMFSetup.rolemap import importRolemap
-        importRolemap( context )
-
-        new_roles = list( getattr( site, '__ac_roles__', [] ) )[:]
-
-        modified_roles.sort()
-        new_roles.sort()
-
-        self.assertEqual( modified_roles, new_roles )
-
-    def test_acquired_permission_explicit_purge( self ):
-
-        ACI = 'Access contents information'
-        VIEW = 'View'
-
-        self.root.site = Folder( id='site' )
-        site = self.root.site
-        site.manage_permission( ACI, () )
-        site.manage_permission( VIEW, () )
-
-        existing_allowed = [ x[ 'name' ]
-                                for x in site.rolesOfPermission( ACI )
-                                if x[ 'selected' ] ]
-
-        self.assertEqual( existing_allowed, [] )
-
-        self.failIf( site.acquiredRolesAreUsedBy( ACI ) )
-        self.failIf( site.acquiredRolesAreUsedBy( VIEW ) )
-
-        context = DummyImportContext( site, True )
-        context._files[ 'rolemap.xml' ] = _ACQUIRED_EXPORT
-
-        from Products.CMFSetup.rolemap import importRolemap
-        importRolemap( context )
-
-        new_allowed = [ x[ 'name' ]
-                           for x in site.rolesOfPermission( ACI )
-                           if x[ 'selected' ] ]
-
-        self.assertEqual( new_allowed, [ 'Manager', 'Owner' ] )
-
-        # ACI is overwritten by XML, but VIEW was purged
-        self.failUnless( site.acquiredRolesAreUsedBy( ACI ) )
-        self.failUnless( site.acquiredRolesAreUsedBy( VIEW ) )
-
-    def test_acquired_permission_no_purge( self ):
-
-        ACI = 'Access contents information'
-        VIEW = 'View'
-
-        self.root.site = Folder( id='site' )
-        site = self.root.site
-        site.manage_permission( ACI, () )
-        site.manage_permission( VIEW, () )
-
-        existing_allowed = [ x[ 'name' ]
-                                for x in site.rolesOfPermission( ACI )
-                                if x[ 'selected' ] ]
-
-        self.assertEqual( existing_allowed, [] )
-
-        self.failIf( site.acquiredRolesAreUsedBy( ACI ) )
-
-        context = DummyImportContext( site, False )
-        context._files[ 'rolemap.xml' ] = _ACQUIRED_EXPORT
-
-        from Products.CMFSetup.rolemap import importRolemap
-        importRolemap( context )
-
-        new_allowed = [ x[ 'name' ]
-                           for x in site.rolesOfPermission( ACI )
-                           if x[ 'selected' ] ]
-
-        self.assertEqual( new_allowed, [ 'Manager', 'Owner' ] )
-
-        # ACI is overwritten by XML, but VIEW is not
-        self.failUnless( site.acquiredRolesAreUsedBy( ACI ) )
-        self.failIf( site.acquiredRolesAreUsedBy( VIEW ) )
-
-    def test_unacquired_permission_explicit_purge( self ):
-
-        ACI = 'Access contents information'
-        VIEW = 'View'
-
-        self.root.site = Folder( id='site' )
-        site = self.root.site
-        site.manage_permission( VIEW, () )
-
-        existing_allowed = [ x[ 'name' ]
-                                for x in site.rolesOfPermission( ACI )
-                                if x[ 'selected' ] ]
-
-        self.assertEqual( existing_allowed, [ 'Manager' ] )
-
-        self.failUnless( site.acquiredRolesAreUsedBy( ACI ) )
-        self.failIf( site.acquiredRolesAreUsedBy( VIEW ) )
-
-        context = DummyImportContext( site, True )
-        context._files[ 'rolemap.xml' ] = _UNACQUIRED_EXPORT
-
-        from Products.CMFSetup.rolemap import importRolemap
-        importRolemap( context )
-
-        new_allowed = [ x[ 'name' ]
-                           for x in site.rolesOfPermission( ACI )
-                           if x[ 'selected' ] ]
-
-        self.assertEqual( new_allowed, [ 'Manager', 'Owner' ] )
-
-        self.failIf( site.acquiredRolesAreUsedBy( ACI ) )
-        self.failUnless( site.acquiredRolesAreUsedBy( VIEW ) )
-
-    def test_unacquired_permission_skip_purge( self ):
-
-        ACI = 'Access contents information'
-        VIEW = 'View'
-
-        self.root.site = Folder( id='site' )
-        site = self.root.site
-        site.manage_permission( VIEW, () )
-
-        existing_allowed = [ x[ 'name' ]
-                                for x in site.rolesOfPermission( ACI )
-                                if x[ 'selected' ] ]
-
-        self.assertEqual( existing_allowed, [ 'Manager' ] )
-
-        self.failUnless( site.acquiredRolesAreUsedBy( ACI ) )
-        self.failIf( site.acquiredRolesAreUsedBy( VIEW ) )
-
-        context = DummyImportContext( site, False )
-        context._files[ 'rolemap.xml' ] = _UNACQUIRED_EXPORT
-
-        from Products.CMFSetup.rolemap import importRolemap
-        importRolemap( context )
-
-        new_allowed = [ x[ 'name' ]
-                           for x in site.rolesOfPermission( ACI )
-                           if x[ 'selected' ] ]
-
-        self.assertEqual( new_allowed, [ 'Manager', 'Owner' ] )
-
-        self.failIf( site.acquiredRolesAreUsedBy( ACI ) )
-        self.failIf( site.acquiredRolesAreUsedBy( VIEW ) )
-
-    def test_unacquired_permission_added_role_explicit_purge( self ):
-
-        ACI = 'Access contents information'
-        VIEW = 'View'
-
-        self.root.site = Folder( id='site' )
-        site = self.root.site
-        site.manage_permission( VIEW, () )
-
-        existing_allowed = [ x[ 'name' ]
-                                for x in site.rolesOfPermission( ACI )
-                                if x[ 'selected' ] ]
-
-        self.assertEqual( existing_allowed, [ 'Manager' ] )
-
-        self.failUnless( site.acquiredRolesAreUsedBy( ACI ) )
-        self.failIf( site.acquiredRolesAreUsedBy( VIEW ) )
-
-        self.failIf( site._has_user_defined_role( 'ZZZ' ) )
-
-        context = DummyImportContext( site, True )
-        context._files[ 'rolemap.xml' ] = _COMBINED_EXPORT
-
-        from Products.CMFSetup.rolemap import importRolemap
-        importRolemap( context )
-
-        self.failUnless( site._has_user_defined_role( 'ZZZ' ) )
-
-        new_allowed = [ x[ 'name' ]
-                           for x in site.rolesOfPermission( ACI )
-                           if x[ 'selected' ] ]
-
-        self.assertEqual( new_allowed, [ 'Manager', 'Owner', 'ZZZ' ] )
-
-        self.failIf( site.acquiredRolesAreUsedBy( ACI ) )
-        self.failUnless( site.acquiredRolesAreUsedBy( VIEW ) )
-
-    def test_unacquired_permission_added_role_skip_purge( self ):
-
-        ACI = 'Access contents information'
-        VIEW = 'View'
-
-        self.root.site = Folder( id='site' )
-        site = self.root.site
-        site.manage_permission( VIEW, () )
-
-        existing_allowed = [ x[ 'name' ]
-                                for x in site.rolesOfPermission( ACI )
-                                if x[ 'selected' ] ]
-
-        self.assertEqual( existing_allowed, [ 'Manager' ] )
-
-        self.failUnless( site.acquiredRolesAreUsedBy( ACI ) )
-        self.failIf( site.acquiredRolesAreUsedBy( VIEW ) )
-
-        self.failIf( site._has_user_defined_role( 'ZZZ' ) )
-
-        context = DummyImportContext( site, False )
-        context._files[ 'rolemap.xml' ] = _COMBINED_EXPORT
-
-        from Products.CMFSetup.rolemap import importRolemap
-        importRolemap( context )
-
-        self.failUnless( site._has_user_defined_role( 'ZZZ' ) )
-
-        new_allowed = [ x[ 'name' ]
-                           for x in site.rolesOfPermission( ACI )
-                           if x[ 'selected' ] ]
-
-        self.assertEqual( new_allowed, [ 'Manager', 'Owner', 'ZZZ' ] )
-
-        self.failIf( site.acquiredRolesAreUsedBy( ACI ) )
-        self.failIf( site.acquiredRolesAreUsedBy( VIEW ) )
-
-    def test_unacquired_permission_added_role_skip_purge_encode_ascii( self ):
-
-        ACI = 'Access contents information'
-        VIEW = 'View'
-
-        self.root.site = Folder( id='site' )
-        site = self.root.site
-        site.manage_permission( VIEW, () )
-
-        existing_allowed = [ x[ 'name' ]
-                                for x in site.rolesOfPermission( ACI )
-                                if x[ 'selected' ] ]
-
-        self.assertEqual( existing_allowed, [ 'Manager' ] )
-
-        self.failUnless( site.acquiredRolesAreUsedBy( ACI ) )
-        self.failIf( site.acquiredRolesAreUsedBy( VIEW ) )
-
-        self.failIf( site._has_user_defined_role( 'ZZZ' ) )
-
-        context = DummyImportContext( site, False, encoding='ascii' )
-        context._files[ 'rolemap.xml' ] = _COMBINED_EXPORT
-
-        from Products.CMFSetup.rolemap import importRolemap
-        importRolemap( context )
-
-        self.failUnless( site._has_user_defined_role( 'ZZZ' ) )
-
-        new_allowed = [ x[ 'name' ]
-                           for x in site.rolesOfPermission( ACI )
-                           if x[ 'selected' ] ]
-
-        self.assertEqual( new_allowed, [ 'Manager', 'Owner', 'ZZZ' ] )
-
-        self.failIf( site.acquiredRolesAreUsedBy( ACI ) )
-        self.failIf( site.acquiredRolesAreUsedBy( VIEW ) )
-
-
-def test_suite():
-    return unittest.TestSuite((
-        unittest.makeSuite( RolemapConfiguratorTests ),
-        unittest.makeSuite( Test_exportRolemap ),
-        unittest.makeSuite( Test_importRolemap ),
-        ))
-
-if __name__ == '__main__':
-    unittest.main(defaultTest='test_suite')

Deleted: CMF/trunk/CMFSetup/tests/test_tool.py
===================================================================
--- CMF/trunk/CMFSetup/tests/test_tool.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFSetup/tests/test_tool.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -1,911 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004 Zope Corporation and Contributors. All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-""" Unit tests for CMFSetup tool.
-
-$Id$
-"""
-
-import unittest
-import Testing
-import Zope2
-Zope2.startup()
-
-from StringIO import StringIO
-
-from Acquisition import aq_base
-from OFS.Folder import Folder
-
-from Products.CMFSetup import profile_registry
-
-from common import DOMComparator
-from common import DummyExportContext
-from common import DummyImportContext
-from common import FilesystemTestBase
-from common import SecurityRequestTest
-from common import TarballTester
-from conformance import ConformsToISetupTool
-
-
-class SetupToolTests( FilesystemTestBase
-                    , TarballTester
-                    , ConformsToISetupTool
-                    ):
-
-    _PROFILE_PATH = '/tmp/STT_test'
-
-    def setUp( self ):
-
-        FilesystemTestBase.setUp( self )
-        self._profile_registry_info = profile_registry._profile_info
-        self._profile_registry_ids = profile_registry._profile_ids
-        profile_registry.clear()
-
-    def tearDown( self ):
-
-        profile_registry._profile_info = self._profile_registry_info
-        profile_registry._profile_ids = self._profile_registry_ids
-        FilesystemTestBase.tearDown( self )
-
-    def _getTargetClass( self ):
-
-        from Products.CMFSetup.tool import SetupTool
-        return SetupTool
-
-    def _makeOne( self, *args, **kw ):
-
-        return self._getTargetClass()( *args, **kw )
-
-    def _makeSite( self, title="Don't care" ):
-
-        site = Folder()
-        site._setId( 'site' )
-        site.title = title
-
-        self.root._setObject( 'site', site )
-        return self.root._getOb( 'site' )
-
-    def test_empty( self ):
-
-        tool = self._makeOne()
-
-        self.assertEqual( tool.getImportContextID(), '' )
-
-        import_registry = tool.getImportStepRegistry()
-        self.assertEqual( len( import_registry.listSteps() ), 0 )
-
-        export_registry = tool.getExportStepRegistry()
-        export_steps = export_registry.listSteps()
-        self.assertEqual( len( export_steps ), 1 )
-        self.assertEqual( export_steps[ 0 ], 'step_registries' )
-
-        toolset_registry = tool.getToolsetRegistry()
-        self.assertEqual( len( toolset_registry.listForbiddenTools() ), 0 )
-        self.assertEqual( len( toolset_registry.listRequiredTools() ), 0 )
-
-    def test_getImportContextID( self ):
-
-        from Products.CMFSetup.tool import IMPORT_STEPS_XML
-        from Products.CMFSetup.tool import EXPORT_STEPS_XML
-        from Products.CMFSetup.tool import TOOLSET_XML
-        from test_registry import _EMPTY_IMPORT_XML
-        from test_registry import _EMPTY_EXPORT_XML
-        from test_registry import _EMPTY_TOOLSET_XML
-        from common import _makeTestFile
-
-        tool = self._makeOne()
-
-        _makeTestFile( IMPORT_STEPS_XML
-                     , self._PROFILE_PATH
-                     , _EMPTY_IMPORT_XML
-                     )
-
-        _makeTestFile( EXPORT_STEPS_XML
-                     , self._PROFILE_PATH
-                     , _EMPTY_EXPORT_XML
-                     )
-
-        _makeTestFile( TOOLSET_XML
-                     , self._PROFILE_PATH
-                     , _EMPTY_TOOLSET_XML
-                     )
-
-        profile_registry.registerProfile('foo', 'Foo', '', self._PROFILE_PATH)
-        tool.setImportContext('profile-other:foo')
-
-        self.assertEqual( tool.getImportContextID(), 'profile-other:foo' )
-
-    def test_setImportContext_invalid( self ):
-
-        tool = self._makeOne()
-
-        self.assertRaises( KeyError
-                         , tool.setImportContext
-                         , 'profile-foo'
-                         )
-
-    def test_setImportContext( self ):
-
-        from Products.CMFSetup.tool import IMPORT_STEPS_XML
-        from Products.CMFSetup.tool import EXPORT_STEPS_XML
-        from Products.CMFSetup.tool import TOOLSET_XML
-        from test_registry import _SINGLE_IMPORT_XML
-        from test_registry import _SINGLE_EXPORT_XML
-        from test_registry import _NORMAL_TOOLSET_XML
-        from test_registry import ONE_FUNC
-        from common import _makeTestFile
-
-        tool = self._makeOne()
-        tool.getExportStepRegistry().clear()
-
-        _makeTestFile( IMPORT_STEPS_XML
-                     , self._PROFILE_PATH
-                     , _SINGLE_IMPORT_XML
-                     )
-
-        _makeTestFile( EXPORT_STEPS_XML
-                     , self._PROFILE_PATH
-                     , _SINGLE_EXPORT_XML
-                     )
-
-        _makeTestFile( TOOLSET_XML
-                     , self._PROFILE_PATH
-                     , _NORMAL_TOOLSET_XML
-                     )
-
-        profile_registry.registerProfile('foo', 'Foo', '', self._PROFILE_PATH)
-        tool.setImportContext('profile-other:foo')
-
-        self.assertEqual( tool.getImportContextID(), 'profile-other:foo' )
-
-        import_registry = tool.getImportStepRegistry()
-        self.assertEqual( len( import_registry.listSteps() ), 1 )
-        self.failUnless( 'one' in import_registry.listSteps() )
-        info = import_registry.getStepMetadata( 'one' )
-        self.assertEqual( info[ 'id' ], 'one' )
-        self.assertEqual( info[ 'title' ], 'One Step' )
-        self.assertEqual( info[ 'version' ], '1' )
-        self.failUnless( 'One small step' in info[ 'description' ] )
-        self.assertEqual( info[ 'handler' ]
-                        , 'Products.CMFSetup.tests.test_registry.ONE_FUNC' )
-
-        self.assertEqual( import_registry.getStep( 'one' ), ONE_FUNC )
-
-        export_registry = tool.getExportStepRegistry()
-        self.assertEqual( len( export_registry.listSteps() ), 1 )
-        self.failUnless( 'one' in import_registry.listSteps() )
-        info = export_registry.getStepMetadata( 'one' )
-        self.assertEqual( info[ 'id' ], 'one' )
-        self.assertEqual( info[ 'title' ], 'One Step' )
-        self.failUnless( 'One small step' in info[ 'description' ] )
-        self.assertEqual( info[ 'handler' ]
-                        , 'Products.CMFSetup.tests.test_registry.ONE_FUNC' )
-
-        self.assertEqual( export_registry.getStep( 'one' ), ONE_FUNC )
-
-        toolset = tool.getToolsetRegistry()
-        self.assertEqual( len( toolset.listForbiddenTools() ), 1 )
-        self.failUnless( 'doomed' in toolset.listForbiddenTools() )
-        self.assertEqual( len( toolset.listRequiredTools() ), 2 )
-        self.failUnless( 'mandatory' in toolset.listRequiredTools() )
-        info = toolset.getRequiredToolInfo( 'mandatory' )
-        self.assertEqual( info[ 'class' ], 'path.to.one' )
-        self.failUnless( 'obligatory' in toolset.listRequiredTools() )
-        info = toolset.getRequiredToolInfo( 'obligatory' )
-        self.assertEqual( info[ 'class' ], 'path.to.another' )
-
-    def test_runImportStep_nonesuch( self ):
-
-        site = self._makeSite()
-
-        tool = self._makeOne().__of__( site )
-
-        self.assertRaises( ValueError, tool.runImportStep, 'nonesuch' )
-
-    def test_runImportStep_simple( self ):
-
-        TITLE = 'original title'
-        site = self._makeSite( TITLE )
-
-        tool = self._makeOne().__of__( site )
-
-        registry = tool.getImportStepRegistry()
-        registry.registerStep( 'simple', '1', _uppercaseSiteTitle )
-
-        result = tool.runImportStep( 'simple' )
-
-        self.assertEqual( len( result[ 'steps' ] ), 1 )
-
-        self.assertEqual( result[ 'steps' ][ 0 ], 'simple' )
-        self.assertEqual( result[ 'messages' ][ 'simple' ]
-                        , 'Uppercased title' )
-
-        self.assertEqual( site.title, TITLE.upper() )
-
-    def test_runImportStep_dependencies( self ):
-
-        TITLE = 'original title'
-        site = self._makeSite( TITLE )
-
-        tool = self._makeOne().__of__( site )
-
-        registry = tool.getImportStepRegistry()
-        registry.registerStep( 'dependable', '1', _underscoreSiteTitle )
-        registry.registerStep( 'dependent', '1'
-                             , _uppercaseSiteTitle, ( 'dependable', ) )
-
-        result = tool.runImportStep( 'dependent' )
-
-        self.assertEqual( len( result[ 'steps' ] ), 2 )
-
-        self.assertEqual( result[ 'steps' ][ 0 ], 'dependable' )
-        self.assertEqual( result[ 'messages' ][ 'dependable' ]
-                        , 'Underscored title' )
-
-        self.assertEqual( result[ 'steps' ][ 1 ], 'dependent' )
-        self.assertEqual( result[ 'messages' ][ 'dependent' ]
-                        , 'Uppercased title' )
-        self.assertEqual( site.title, TITLE.replace( ' ', '_' ).upper() )
-
-    def test_runImportStep_skip_dependencies( self ):
-
-        TITLE = 'original title'
-        site = self._makeSite( TITLE )
-
-        tool = self._makeOne().__of__( site )
-
-        registry = tool.getImportStepRegistry()
-        registry.registerStep( 'dependable', '1', _underscoreSiteTitle )
-        registry.registerStep( 'dependent', '1'
-                             , _uppercaseSiteTitle, ( 'dependable', ) )
-
-        result = tool.runImportStep( 'dependent', run_dependencies=False )
-
-        self.assertEqual( len( result[ 'steps' ] ), 1 )
-
-        self.assertEqual( result[ 'steps' ][ 0 ], 'dependent' )
-        self.assertEqual( result[ 'messages' ][ 'dependent' ]
-                        , 'Uppercased title' )
-
-        self.assertEqual( site.title, TITLE.upper() )
-
-    def test_runImportStep_default_purge( self ):
-
-        site = self._makeSite()
-
-        tool = self._makeOne().__of__( site )
-        registry = tool.getImportStepRegistry()
-        registry.registerStep( 'purging', '1', _purgeIfRequired )
-
-        result = tool.runImportStep( 'purging' )
-
-        self.assertEqual( len( result[ 'steps' ] ), 1 )
-        self.assertEqual( result[ 'steps' ][ 0 ], 'purging' )
-        self.assertEqual( result[ 'messages' ][ 'purging' ], 'Purged' )
-        self.failUnless( site.purged )
-
-    def test_runImportStep_explicit_purge( self ):
-
-        site = self._makeSite()
-
-        tool = self._makeOne().__of__( site )
-        registry = tool.getImportStepRegistry()
-        registry.registerStep( 'purging', '1', _purgeIfRequired )
-
-        result = tool.runImportStep( 'purging', purge_old=True )
-
-        self.assertEqual( len( result[ 'steps' ] ), 1 )
-        self.assertEqual( result[ 'steps' ][ 0 ], 'purging' )
-        self.assertEqual( result[ 'messages' ][ 'purging' ], 'Purged' )
-        self.failUnless( site.purged )
-
-    def test_runImportStep_skip_purge( self ):
-
-        site = self._makeSite()
-
-        tool = self._makeOne().__of__( site )
-        registry = tool.getImportStepRegistry()
-        registry.registerStep( 'purging', '1', _purgeIfRequired )
-
-        result = tool.runImportStep( 'purging', purge_old=False )
-
-        self.assertEqual( len( result[ 'steps' ] ), 1 )
-        self.assertEqual( result[ 'steps' ][ 0 ], 'purging' )
-        self.assertEqual( result[ 'messages' ][ 'purging' ], 'Unpurged' )
-        self.failIf( site.purged )
-
-    def test_runImportStep_consistent_context( self ):
-
-        site = self._makeSite()
-
-        tool = self._makeOne().__of__( site )
-
-        registry = tool.getImportStepRegistry()
-        registry.registerStep( 'purging', '1', _purgeIfRequired )
-        registry.registerStep( 'dependent', '1'
-                             , _uppercaseSiteTitle, ( 'purging', ) )
-
-        result = tool.runImportStep( 'dependent', purge_old=False )
-        self.failIf( site.purged )
-
-    def test_runAllImportSteps_empty( self ):
-
-        site = self._makeSite()
-        tool = self._makeOne().__of__( site )
-
-        result = tool.runAllImportSteps()
-
-        self.assertEqual( len( result[ 'steps' ] ), 0 )
-
-    def test_runAllImportSteps_sorted_default_purge( self ):
-
-        TITLE = 'original title'
-        site = self._makeSite( TITLE )
-        tool = self._makeOne().__of__( site )
-
-        registry = tool.getImportStepRegistry()
-        registry.registerStep( 'dependable', '1'
-                             , _underscoreSiteTitle, ( 'purging', ) )
-        registry.registerStep( 'dependent', '1'
-                             , _uppercaseSiteTitle, ( 'dependable', ) )
-        registry.registerStep( 'purging', '1'
-                             , _purgeIfRequired )
-
-        result = tool.runAllImportSteps()
-
-        self.assertEqual( len( result[ 'steps' ] ), 3 )
-
-        self.assertEqual( result[ 'steps' ][ 0 ], 'purging' )
-        self.assertEqual( result[ 'messages' ][ 'purging' ]
-                        , 'Purged' )
-
-        self.assertEqual( result[ 'steps' ][ 1 ], 'dependable' )
-        self.assertEqual( result[ 'messages' ][ 'dependable' ]
-                        , 'Underscored title' )
-
-        self.assertEqual( result[ 'steps' ][ 2 ], 'dependent' )
-        self.assertEqual( result[ 'messages' ][ 'dependent' ]
-                        , 'Uppercased title' )
-
-        self.assertEqual( site.title, TITLE.replace( ' ', '_' ).upper() )
-        self.failUnless( site.purged )
-
-    def test_runAllImportSteps_sorted_explicit_purge( self ):
-
-        site = self._makeSite()
-        tool = self._makeOne().__of__( site )
-
-        registry = tool.getImportStepRegistry()
-        registry.registerStep( 'dependable', '1'
-                             , _underscoreSiteTitle, ( 'purging', ) )
-        registry.registerStep( 'dependent', '1'
-                             , _uppercaseSiteTitle, ( 'dependable', ) )
-        registry.registerStep( 'purging', '1'
-                             , _purgeIfRequired )
-
-        result = tool.runAllImportSteps( purge_old=True )
-
-        self.assertEqual( len( result[ 'steps' ] ), 3 )
-
-        self.assertEqual( result[ 'steps' ][ 0 ], 'purging' )
-        self.assertEqual( result[ 'messages' ][ 'purging' ]
-                        , 'Purged' )
-
-        self.assertEqual( result[ 'steps' ][ 1 ], 'dependable' )
-        self.assertEqual( result[ 'steps' ][ 2 ], 'dependent' )
-        self.failUnless( site.purged )
-
-    def test_runAllImportSteps_sorted_skip_purge( self ):
-
-        site = self._makeSite()
-        tool = self._makeOne().__of__( site )
-
-        registry = tool.getImportStepRegistry()
-        registry.registerStep( 'dependable', '1'
-                             , _underscoreSiteTitle, ( 'purging', ) )
-        registry.registerStep( 'dependent', '1'
-                             , _uppercaseSiteTitle, ( 'dependable', ) )
-        registry.registerStep( 'purging', '1'
-                             , _purgeIfRequired )
-
-        result = tool.runAllImportSteps( purge_old=False )
-
-        self.assertEqual( len( result[ 'steps' ] ), 3 )
-
-        self.assertEqual( result[ 'steps' ][ 0 ], 'purging' )
-        self.assertEqual( result[ 'messages' ][ 'purging' ]
-                        , 'Unpurged' )
-
-        self.assertEqual( result[ 'steps' ][ 1 ], 'dependable' )
-        self.assertEqual( result[ 'steps' ][ 2 ], 'dependent' )
-        self.failIf( site.purged )
-
-    def test_runExportStep_nonesuch( self ):
-
-        site = self._makeSite()
-        tool = self._makeOne().__of__( site )
-
-        self.assertRaises( ValueError, tool.runExportStep, 'nonesuch' )
-
-    def test_runExportStep_step_registry( self ):
-
-        from test_registry import _EMPTY_IMPORT_XML
-
-        site = self._makeSite()
-        site.portal_setup = self._makeOne()
-        tool = site.portal_setup
-
-        result = tool.runExportStep( 'step_registries' )
-
-        self.assertEqual( len( result[ 'steps' ] ), 1 )
-        self.assertEqual( result[ 'steps' ][ 0 ], 'step_registries' )
-        self.assertEqual( result[ 'messages' ][ 'step_registries' ]
-                        , 'Step registries exported'
-                        )
-        fileish = StringIO( result[ 'tarball' ] )
-
-        self._verifyTarballContents( fileish, [ 'import_steps.xml'
-                                              , 'export_steps.xml'
-                                              ] )
-        self._verifyTarballEntryXML( fileish, 'import_steps.xml'
-                                   , _EMPTY_IMPORT_XML )
-        self._verifyTarballEntryXML( fileish, 'export_steps.xml'
-                                   , _DEFAULT_STEP_REGISTRIES_EXPORT_XML )
-
-    def test_runAllExportSteps_default( self ):
-
-        from test_registry import _EMPTY_IMPORT_XML
-
-        site = self._makeSite()
-        site.portal_setup = self._makeOne()
-        tool = site.portal_setup
-
-        result = tool.runAllExportSteps()
-
-        self.assertEqual( len( result[ 'steps' ] ), 1 )
-        self.assertEqual( result[ 'steps' ][ 0 ], 'step_registries' )
-        self.assertEqual( result[ 'messages' ][ 'step_registries' ]
-                        , 'Step registries exported'
-                        )
-        fileish = StringIO( result[ 'tarball' ] )
-
-        self._verifyTarballContents( fileish, [ 'import_steps.xml'
-                                              , 'export_steps.xml'
-                                              ] )
-        self._verifyTarballEntryXML( fileish, 'import_steps.xml'
-                                   , _EMPTY_IMPORT_XML )
-        self._verifyTarballEntryXML( fileish, 'export_steps.xml'
-                                   , _DEFAULT_STEP_REGISTRIES_EXPORT_XML )
-
-    def test_runAllExportSteps_extras( self ):
-
-        from test_registry import _EMPTY_IMPORT_XML
-
-        site = self._makeSite()
-        site.portal_setup = self._makeOne()
-        tool = site.portal_setup
-
-        import_reg = tool.getImportStepRegistry()
-        import_reg.registerStep( 'dependable', '1'
-                               , _underscoreSiteTitle, ( 'purging', ) )
-        import_reg.registerStep( 'dependent', '1'
-                               , _uppercaseSiteTitle, ( 'dependable', ) )
-        import_reg.registerStep( 'purging', '1'
-                               , _purgeIfRequired )
-
-        export_reg = tool.getExportStepRegistry()
-        export_reg.registerStep( 'properties'
-                               , _exportPropertiesINI )
-
-        result = tool.runAllExportSteps()
-
-        self.assertEqual( len( result[ 'steps' ] ), 2 )
-
-        self.failUnless( 'properties' in result[ 'steps' ] )
-        self.assertEqual( result[ 'messages' ][ 'properties' ]
-                        , 'Exported properties'
-                        )
-
-        self.failUnless( 'step_registries' in result[ 'steps' ] )
-        self.assertEqual( result[ 'messages' ][ 'step_registries' ]
-                        , 'Step registries exported'
-                        )
-
-        fileish = StringIO( result[ 'tarball' ] )
-
-        self._verifyTarballContents( fileish, [ 'import_steps.xml'
-                                              , 'export_steps.xml'
-                                              , 'properties.ini'
-                                              ] )
-        self._verifyTarballEntryXML( fileish, 'import_steps.xml'
-                                   , _EXTRAS_STEP_REGISTRIES_IMPORT_XML )
-        self._verifyTarballEntryXML( fileish, 'export_steps.xml'
-                                   , _EXTRAS_STEP_REGISTRIES_EXPORT_XML )
-        self._verifyTarballEntry( fileish, 'properties.ini'
-                                , _PROPERTIES_INI % site.title  )
-
-    def test_createSnapshot_default( self ):
-
-        from test_registry import _EMPTY_IMPORT_XML
-
-        _EXPECTED = [ ( 'import_steps.xml', _EMPTY_IMPORT_XML )
-                    , ( 'export_steps.xml'
-                      , _DEFAULT_STEP_REGISTRIES_EXPORT_XML
-                      )
-                    ]
-
-        site = self._makeSite()
-        site.portal_setup = self._makeOne()
-        tool = site.portal_setup
-
-        self.assertEqual( len( tool.listSnapshotInfo() ), 0 )
-
-        result = tool.createSnapshot( 'default' )
-
-        self.assertEqual( len( result[ 'steps' ] ), 1 )
-        self.assertEqual( result[ 'steps' ][ 0 ], 'step_registries' )
-        self.assertEqual( result[ 'messages' ][ 'step_registries' ]
-                        , 'Step registries exported'
-                        )
-
-        snapshot = result[ 'snapshot' ]
-
-        self.assertEqual( len( snapshot.objectIds() ), len( _EXPECTED ) )
-
-        for id in [ x[0] for x in _EXPECTED ]:
-            self.failUnless( id in snapshot.objectIds() )
-
-        def normalize_xml(xml):
-            # using this might mask a real problem on windows, but so far the
-            # different newlines just caused problems in this test
-            lines = [ line for line in xml.splitlines() if line ]
-            return '\n'.join(lines) + '\n'
-
-        fileobj = snapshot._getOb( 'import_steps.xml' )
-        self.assertEqual( normalize_xml( fileobj.read() ),
-                          _EMPTY_IMPORT_XML )
-
-        fileobj = snapshot._getOb( 'export_steps.xml' )
-
-        self.assertEqual( normalize_xml( fileobj.read() ),
-                          _DEFAULT_STEP_REGISTRIES_EXPORT_XML )
-
-        self.assertEqual( len( tool.listSnapshotInfo() ), 1 )
-
-        info = tool.listSnapshotInfo()[ 0 ]
-
-        self.assertEqual( info[ 'id' ], 'default' )
-        self.assertEqual( info[ 'title' ], 'default' )
-
-
-_DEFAULT_STEP_REGISTRIES_EXPORT_XML = """\
-<?xml version="1.0"?>
-<export-steps>
- <export-step id="step_registries"
-              handler="Products.CMFSetup.tool.exportStepRegistries"
-              title="Export import / export steps.">
-  
- </export-step>
-</export-steps>
-"""
-
-_EXTRAS_STEP_REGISTRIES_EXPORT_XML = """\
-<?xml version="1.0"?>
-<export-steps>
- <export-step id="properties"
-              handler="Products.CMFSetup.tests.test_tool._exportPropertiesINI"
-              title="properties">
-
- </export-step>
- <export-step id="step_registries"
-              handler="Products.CMFSetup.tool.exportStepRegistries"
-              title="Export import / export steps.">
-
- </export-step>
-</export-steps>
-"""
-
-_EXTRAS_STEP_REGISTRIES_IMPORT_XML = """\
-<?xml version="1.0"?>
-<import-steps>
- <import-step id="dependable"
-              version="1"
-              handler="Products.CMFSetup.tests.test_tool._underscoreSiteTitle"
-              title="dependable">
-  <dependency step="purging" />
-
- </import-step>
- <import-step id="dependent"
-              version="1"
-              handler="Products.CMFSetup.tests.test_tool._uppercaseSiteTitle"
-              title="dependent">
-  <dependency step="dependable" />
-
- </import-step>
- <import-step id="purging"
-              version="1"
-              handler="Products.CMFSetup.tests.test_tool._purgeIfRequired"
-              title="purging">
-
- </import-step>
-</import-steps>
-"""
-
-_PROPERTIES_INI = """\
-[Default]
-Title=%s
-"""
-
-def _underscoreSiteTitle( context ):
-
-    site = context.getSite()
-    site.title = site.title.replace( ' ', '_' )
-    return 'Underscored title'
-
-def _uppercaseSiteTitle( context ):
-
-    site = context.getSite()
-    site.title = site.title.upper()
-    return 'Uppercased title'
-
-def _purgeIfRequired( context ):
-
-    site = context.getSite()
-    purged = site.purged = context.shouldPurge()
-    return purged and 'Purged' or 'Unpurged'
-
-def _exportPropertiesINI( context ):
-
-    site = context.getSite()
-    text = _PROPERTIES_INI % site.title
-
-    context.writeDataFile( 'properties.ini', text, 'text/plain' )
-
-    return 'Exported properties'
-
-class _ToolsetSetup( SecurityRequestTest ):
-
-    def _initSite( self ):
-
-        from Products.CMFSetup.tool import SetupTool
-        site = Folder()
-        site._setId( 'site' )
-        self.root._setObject( 'site', site )
-        site = self.root._getOb( 'site' )
-        site._setObject( 'portal_setup', SetupTool() )
-        return site
-
-class Test_exportToolset( _ToolsetSetup
-                        , DOMComparator
-                        ):
-
-    def test_empty( self ):
-
-        from Products.CMFSetup.tool import TOOLSET_XML
-        from Products.CMFSetup.tool import exportToolset
-
-        site = self._initSite()
-        context = DummyExportContext( site )
-
-        exportToolset( context )
-
-        self.assertEqual( len( context._wrote ), 1 )
-        filename, text, content_type = context._wrote[ 0 ]
-        self.assertEqual( filename, TOOLSET_XML )
-        self._compareDOM( text, _EMPTY_TOOLSET_XML )
-        self.assertEqual( content_type, 'text/xml' )
-
-    def test_normal( self ):
-
-        from Products.CMFSetup.tool import TOOLSET_XML
-        from Products.CMFSetup.tool import exportToolset
-
-        site = self._initSite()
-        toolset = site.portal_setup.getToolsetRegistry()
-        toolset.addForbiddenTool( 'doomed' )
-        toolset.addRequiredTool( 'mandatory', 'path.to.one' )
-        toolset.addRequiredTool( 'obligatory', 'path.to.another' )
-
-        context = DummyExportContext( site )
-
-        exportToolset( context )
-
-        self.assertEqual( len( context._wrote ), 1 )
-        filename, text, content_type = context._wrote[ 0 ]
-        self.assertEqual( filename, TOOLSET_XML )
-        self._compareDOM( text, _NORMAL_TOOLSET_XML )
-        self.assertEqual( content_type, 'text/xml' )
-
-class Test_importToolset( _ToolsetSetup ):
-
-    def test_tool_ids( self ):
-        # The tool import mechanism used to rely on the fact that all tools
-        # have unique IDs set at the class level and that you can call their
-        # constructor with no arguments. However, there might be tools 
-        # that need IDs set.
-        from Products.CMFSetup.tool import TOOLSET_XML
-        from Products.CMFSetup.tool import importToolset
-
-        site = self._initSite()
-        context = DummyImportContext( site )
-        context._files[ TOOLSET_XML ] = _REQUIRED_TOOLSET_XML
-
-        importToolset( context )
-
-        for tool_id in ( 'mandatory', 'obligatory' ):
-            tool = getattr( site, tool_id )
-            self.assertEqual( tool.getId(), tool_id )
-
-    def test_forbidden_tools( self ):
-
-        from Products.CMFSetup.tool import TOOLSET_XML
-        from Products.CMFSetup.tool import importToolset
-        TOOL_IDS = ( 'doomed', 'blasted', 'saved' )
-
-        site = self._initSite()
-
-        for tool_id in TOOL_IDS:
-            pseudo = Folder()
-            pseudo._setId( tool_id )
-            site._setObject( tool_id, pseudo )
-
-        self.assertEqual( len( site.objectIds() ), len( TOOL_IDS ) + 1 )
-
-        for tool_id in TOOL_IDS:
-            self.failUnless( tool_id in site.objectIds() )
-
-        context = DummyImportContext( site )
-        context._files[ TOOLSET_XML ] = _FORBIDDEN_TOOLSET_XML
-
-        importToolset( context )
-
-        self.assertEqual( len( site.objectIds() ), 2 )
-        self.failUnless( 'portal_setup' in site.objectIds() )
-        self.failUnless( 'saved' in site.objectIds() )
-
-    def test_required_tools_missing( self ):
-
-        from Products.CMFSetup.tool import TOOLSET_XML
-        from Products.CMFSetup.tool import importToolset
-
-        site = self._initSite()
-        self.assertEqual( len( site.objectIds() ), 1 )
-
-        context = DummyImportContext( site )
-        context._files[ TOOLSET_XML ] = _REQUIRED_TOOLSET_XML
-
-        importToolset( context )
-
-        self.assertEqual( len( site.objectIds() ), 3 )
-        self.failUnless( isinstance( aq_base( site._getOb( 'mandatory' ) )
-                                   , DummyTool ) )
-        self.failUnless( isinstance( aq_base( site._getOb( 'obligatory' ) )
-                                   , DummyTool ) )
-
-    def test_required_tools_no_replacement( self ):
-
-        from Products.CMFSetup.tool import TOOLSET_XML
-        from Products.CMFSetup.tool import importToolset
-
-        site = self._initSite()
-
-        mandatory = DummyTool()
-        mandatory._setId( 'mandatory' )
-        site._setObject( 'mandatory', mandatory )
-
-        obligatory = DummyTool()
-        obligatory._setId( 'obligatory' )
-        site._setObject( 'obligatory', obligatory )
-
-        self.assertEqual( len( site.objectIds() ), 3 )
-
-        context = DummyImportContext( site )
-        context._files[ TOOLSET_XML ] = _REQUIRED_TOOLSET_XML
-
-        importToolset( context )
-
-        self.assertEqual( len( site.objectIds() ), 3 )
-        self.failUnless( aq_base( site._getOb( 'mandatory' ) ) is mandatory )
-        self.failUnless( aq_base( site._getOb( 'obligatory' ) ) is obligatory )
-
-    def test_required_tools_with_replacement( self ):
-
-        from Products.CMFSetup.tool import TOOLSET_XML
-        from Products.CMFSetup.tool import importToolset
-
-        site = self._initSite()
-
-        mandatory = AnotherDummyTool()
-        mandatory._setId( 'mandatory' )
-        site._setObject( 'mandatory', mandatory )
-
-        obligatory = AnotherDummyTool()
-        obligatory._setId( 'obligatory' )
-        site._setObject( 'obligatory', obligatory )
-
-        self.assertEqual( len( site.objectIds() ), 3 )
-
-        context = DummyImportContext( site )
-        context._files[ TOOLSET_XML ] = _REQUIRED_TOOLSET_XML
-
-        importToolset( context )
-
-        self.assertEqual( len( site.objectIds() ), 3 )
-
-        self.failIf( aq_base( site._getOb( 'mandatory' ) ) is mandatory )
-        self.failUnless( isinstance( aq_base( site._getOb( 'mandatory' ) )
-                                   , DummyTool ) )
-
-        self.failIf( aq_base( site._getOb( 'obligatory' ) ) is obligatory )
-        self.failUnless( isinstance( aq_base( site._getOb( 'obligatory' ) )
-                                   , DummyTool ) )
-
-
-class DummyTool( Folder ):
-
-    pass
-
-class AnotherDummyTool( Folder ):
-
-    pass
-
-
-_EMPTY_TOOLSET_XML = """\
-<?xml version="1.0"?>
-<tool-setup>
-</tool-setup>
-"""
-
-_NORMAL_TOOLSET_XML = """\
-<?xml version="1.0" ?>
-<tool-setup>
-<forbidden tool_id="doomed"/>
-<required class="path.to.one" tool_id="mandatory"/>
-<required class="path.to.another" tool_id="obligatory"/>
-</tool-setup>
-"""
-
-_FORBIDDEN_TOOLSET_XML = """\
-<?xml version="1.0"?>
-<tool-setup>
- <forbidden tool_id="doomed" />
- <forbidden tool_id="damned" />
- <forbidden tool_id="blasted" />
-</tool-setup>
-"""
-
-_REQUIRED_TOOLSET_XML = """\
-<?xml version="1.0"?>
-<tool-setup>
- <required
-    tool_id="mandatory"
-    class="Products.CMFSetup.tests.test_tool.DummyTool" />
- <required
-    tool_id="obligatory"
-    class="Products.CMFSetup.tests.test_tool.DummyTool" />
-</tool-setup>
-"""
-
-def test_suite():
-    # reimport to make sure tests are run from Products
-    from Products.CMFSetup.tests.test_tool import SetupToolTests
-    from Products.CMFSetup.tests.test_tool import Test_exportToolset
-    from Products.CMFSetup.tests.test_tool import Test_importToolset
-
-    return unittest.TestSuite((
-        unittest.makeSuite( SetupToolTests ),
-        unittest.makeSuite( Test_exportToolset ),
-        unittest.makeSuite( Test_importToolset ),
-        ))
-
-if __name__ == '__main__':
-    unittest.main(defaultTest='test_suite')

Modified: CMF/trunk/CMFSetup/tool.py
===================================================================
--- CMF/trunk/CMFSetup/tool.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFSetup/tool.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -15,715 +15,7 @@
 $Id$
 """
 
-import os
-import time
-from cgi import escape
-
-from AccessControl import ClassSecurityInfo
-from Acquisition import aq_base
-from Globals import InitializeClass
-from OFS.Folder import Folder
-from Products.PageTemplates.PageTemplateFile import PageTemplateFile
-
-from Products.CMFCore.utils import UniqueObject
-from Products.CMFCore.utils import ImmutableId
-from Products.CMFCore.utils import getToolByName
-
-from interfaces import EXTENSION
-from interfaces import ISetupTool
-from permissions import ManagePortal
-from context import DirectoryImportContext
-from context import SnapshotImportContext
-from context import TarballExportContext
-from context import SnapshotExportContext
-from differ import ConfigDiff
-from registry import ImportStepRegistry
-from registry import ExportStepRegistry
-from registry import ToolsetRegistry
-from registry import _profile_registry
-
-from utils import _resolveDottedName
-from utils import _wwwdir
-
-IMPORT_STEPS_XML = 'import_steps.xml'
-EXPORT_STEPS_XML = 'export_steps.xml'
-TOOLSET_XML = 'toolset.xml'
-
-def exportStepRegistries( context ):
-
-    """ Built-in handler for exporting import / export step registries.
-    """
-    site = context.getSite()
-    tool = getToolByName( site, 'portal_setup' )
-
-    import_steps_xml = tool.getImportStepRegistry().generateXML()
-    context.writeDataFile( 'import_steps.xml', import_steps_xml, 'text/xml' )
-
-    export_steps_xml = tool.getExportStepRegistry().generateXML()
-    context.writeDataFile( 'export_steps.xml', export_steps_xml, 'text/xml' )
-
-    return 'Step registries exported'
-
-def importToolset( context ):
-
-    """ Import required / forbidden tools from XML file.
-    """
-    site = context.getSite()
-    encoding = context.getEncoding()
-
-    xml = context.readDataFile(TOOLSET_XML)
-    if xml is None:
-        return 'Toolset: Nothing to import.'
-
-    setup_tool = getToolByName( site, 'portal_setup' )
-    toolset = setup_tool.getToolsetRegistry()
-
-    toolset.parseXML(xml, encoding)
-
-    existing_ids = site.objectIds()
-    existing_values = site.objectValues()
-
-    for tool_id in toolset.listForbiddenTools():
-
-        if tool_id in existing_ids:
-            site._delObject( tool_id )
-
-    for info in toolset.listRequiredToolInfo():
-
-        tool_id = str( info[ 'id' ] )
-        tool_class = _resolveDottedName( info[ 'class' ] )
-
-        existing = getToolByName( site, tool_id, None )
-        new_tool = tool_class()
-
-        if not isinstance( new_tool, ImmutableId ):
-            new_tool._setId( tool_id )
-
-        if existing is None:
-            site._setObject( tool_id, new_tool )
-
-        else:
-            unwrapped = aq_base( existing )
-            if not isinstance( unwrapped, tool_class ):
-                site._delObject( tool_id )
-                site._setObject( tool_id, new_tool )
-
-    return 'Toolset imported.'
-
-def exportToolset( context ):
-
-    """ Export required / forbidden tools to XML file.
-    """
-    site = context.getSite()
-    setup_tool = getToolByName( site, 'portal_setup' )
-    toolset = setup_tool.getToolsetRegistry()
-
-    xml = toolset.generateXML()
-    context.writeDataFile( TOOLSET_XML, xml, 'text/xml' )
-
-    return 'Toolset exported.'
-
-
-class SetupTool( UniqueObject, Folder ):
-
-    """ Profile-based site configuration manager.
-    """
-    __implements__ = ( ISetupTool, ) + Folder.__implements__
-
-    id = 'portal_setup'
-    meta_type = 'Portal Setup Tool'
-
-    _import_context_id = ''
-
-    security = ClassSecurityInfo()
-
-    def __init__( self ):
-
-        self._import_registry = ImportStepRegistry()
-        self._export_registry = ExportStepRegistry()
-        self._export_registry.registerStep( 'step_registries'
-                                          , exportStepRegistries
-                                          , 'Export import / export steps.'
-                                          )
-        self._toolset_registry = ToolsetRegistry()
-
-    #
-    #   ISetupTool API
-    #
-    security.declareProtected( ManagePortal, 'getEncoding' )
-    def getEncoding( self ):
-
-        """ See ISetupTool.
-        """
-        return 'ascii'
-
-    security.declareProtected( ManagePortal, 'getImportContextId' )
-    def getImportContextID( self ):
-
-        """ See ISetupTool.
-        """
-        return self._import_context_id
-
-    security.declareProtected(ManagePortal, 'setImportContext')
-    def setImportContext(self, context_id, encoding=None):
-
-        """ See ISetupTool.
-        """
-        self._import_context_id = context_id
-
-        self._updateImportStepsRegistry( encoding )
-        self._updateExportStepsRegistry( encoding )
-        self._updateToolsetRegistry( encoding )
-
-    security.declareProtected( ManagePortal, 'getImportStepRegistry' )
-    def getImportStepRegistry( self ):
-
-        """ See ISetupTool.
-        """
-        return self._import_registry
-
-    security.declareProtected( ManagePortal, 'getImportStepRegistry' )
-    def getExportStepRegistry( self ):
-
-        """ See ISetupTool.
-        """
-        return self._export_registry
-
-    security.declareProtected( ManagePortal, 'getToolsetRegistry' )
-    def getToolsetRegistry( self ):
-
-        """ See ISetupTool.
-        """
-        return self._toolset_registry
-
-    security.declareProtected( ManagePortal, 'executeStep' )
-    def runImportStep( self, step_id, run_dependencies=True, purge_old=None ):
-
-        """ See ISetupTool.
-        """
-        context = self._getImportContext(self._import_context_id, purge_old)
-
-        info = self._import_registry.getStepMetadata( step_id )
-
-        if info is None:
-            raise ValueError, 'No such import step: %s' % step_id
-
-        dependencies = info.get( 'dependencies', () )
-
-        messages = {}
-        steps = []
-        if run_dependencies:
-            for dependency in dependencies:
-
-                if dependency not in steps:
-                    message = self._doRunImportStep( dependency, context )
-                    messages[ dependency ] = message
-                    steps.append( dependency )
-
-        message = self._doRunImportStep( step_id, context )
-        messages[ step_id ] = message
-        steps.append( step_id )
-
-        return { 'steps' : steps, 'messages' : messages }
-
-    security.declareProtected( ManagePortal, 'runAllSetupSteps')
-    def runAllImportSteps( self, purge_old=None ):
-
-        """ See ISetupTool.
-        """
-        context = self._getImportContext(self._import_context_id, purge_old)
-
-        steps = self._import_registry.sortSteps()
-        messages = {}
-
-        for step in steps:
-            message = self._doRunImportStep( step, context )
-            messages[ step ] = message
-
-        return { 'steps' : steps, 'messages' : messages }
-
-    security.declareProtected( ManagePortal, 'runExportStep')
-    def runExportStep( self, step_id ):
-
-        """ See ISetupTool.
-        """
-        return self._doRunExportSteps( [ step_id ] )
-
-    security.declareProtected(ManagePortal, 'runAllExportSteps')
-    def runAllExportSteps( self ):
-
-        """ See ISetupTool.
-        """
-        return self._doRunExportSteps( self._export_registry.listSteps() )
-
-    security.declareProtected( ManagePortal, 'createSnapshot')
-    def createSnapshot( self, snapshot_id ):
-
-        """ See ISetupTool.
-        """
-        context = SnapshotExportContext( self, snapshot_id )
-        messages = {}
-        steps = self._export_registry.listSteps()
-
-        for step_id in steps:
-
-            handler = self._export_registry.getStep( step_id )
-
-            if handler is None:
-                raise ValueError( 'Invalid export step: %s' % step_id )
-
-            messages[ step_id ] = handler( context )
-
-
-        return { 'steps' : steps
-               , 'messages' : messages
-               , 'url' : context.getSnapshotURL()
-               , 'snapshot' : context.getSnapshotFolder()
-               }
-
-    security.declareProtected(ManagePortal, 'compareConfigurations')
-    def compareConfigurations( self
-                             , lhs_context
-                             , rhs_context
-                             , missing_as_empty=False
-                             , ignore_blanks=False
-                             , skip=( 'CVS', '.svn' )
-                             ):
-        """ See ISetupTool.
-        """
-        differ = ConfigDiff( lhs_context
-                           , rhs_context
-                           , missing_as_empty
-                           , ignore_blanks
-                           , skip
-                           )
-
-        return differ.compare()
-
-    security.declareProtected( ManagePortal, 'markupComparison')
-    def markupComparison(self, lines):
-
-        """ See ISetupTool.
-        """
-        result = []
-
-        for line in lines.splitlines():
-
-            if line.startswith('** '):
-
-                if line.find('File') > -1:
-                    if line.find('replaced') > -1:
-                        result.append( ( 'file-to-dir', line ) )
-                    elif line.find('added') > -1:
-                        result.append( ( 'file-added', line ) )
-                    else:
-                        result.append( ( 'file-removed', line ) )
-                else:
-                    if line.find('replaced') > -1:
-                        result.append( ( 'dir-to-file', line ) )
-                    elif line.find('added') > -1:
-                        result.append( ( 'dir-added', line ) )
-                    else:
-                        result.append( ( 'dir-removed', line ) )
-
-            elif line.startswith('@@'):
-                result.append( ( 'diff-range', line ) )
-
-            elif line.startswith(' '):
-                result.append( ( 'diff-context', line ) )
-
-            elif line.startswith('+'):
-                result.append( ( 'diff-added', line ) )
-
-            elif line.startswith('-'):
-                result.append( ( 'diff-removed', line ) )
-
-            elif line == '\ No newline at end of file':
-                result.append( ( 'diff-context', line ) )
-
-            else:
-                result.append( ( 'diff-header', line ) )
-
-        return '<pre>\n%s\n</pre>' % (
-            '\n'.join( [ ( '<span class="%s">%s</span>' % ( cl, escape( l ) ) )
-                                  for cl, l in result] ) )
-
-    #
-    #   ZMI
-    #
-    manage_options = ( Folder.manage_options[ :1 ]
-                     + ( { 'label' : 'Properties'
-                         , 'action' : 'manage_tool'
-                         }
-                       , { 'label' : 'Import'
-                         , 'action' : 'manage_importSteps'
-                         }
-                       , { 'label' : 'Export'
-                         , 'action' : 'manage_exportSteps'
-                         }
-                       , { 'label' : 'Snapshots'
-                         , 'action' : 'manage_snapshots'
-                         }
-                       , { 'label' : 'Comparison'
-                         , 'action' : 'manage_showDiff'
-                         }
-                       )
-                     + Folder.manage_options[ 3: ] # skip "View", "Properties"
-                     )
-
-    security.declareProtected( ManagePortal, 'manage_tool' )
-    manage_tool = PageTemplateFile( 'sutProperties', _wwwdir )
-
-    security.declareProtected( ManagePortal, 'manage_updateToolProperties' )
-    def manage_updateToolProperties(self, context_id, RESPONSE):
-        """ Update the tool's settings.
-        """
-        self.setImportContext(context_id)
-
-        RESPONSE.redirect( '%s/manage_tool?manage_tabs_message=%s'
-                         % ( self.absolute_url(), 'Properties+updated.' )
-                         )
-
-    security.declareProtected( ManagePortal, 'manage_importSteps' )
-    manage_importSteps = PageTemplateFile( 'sutImportSteps', _wwwdir )
-
-    security.declareProtected( ManagePortal, 'manage_importSelectedSteps' )
-    def manage_importSelectedSteps( self
-                                  , ids
-                                  , run_dependencies
-                                  , RESPONSE
-                                  ):
-        """ Import the steps selected by the user.
-        """
-        if not ids:
-            message = 'No+steps+selected.'
-
-        else:
-            steps_run = []
-            for step_id in ids:
-                result = self.runImportStep( step_id, run_dependencies )
-                steps_run.extend( result[ 'steps' ] )
-
-            message = 'Steps+run:%s' % '+,'.join( steps_run )
-
-        RESPONSE.redirect( '%s/manage_importSteps?manage_tabs_message=%s'
-                         % ( self.absolute_url(), message )
-                         )
-
-    security.declareProtected( ManagePortal, 'manage_importSelectedSteps' )
-    def manage_importAllSteps( self, RESPONSE ):
-
-        """ Import all steps.
-        """
-        result = self.runAllImportSteps()
-        message = 'Steps+run:%s' % '+,'.join( result[ 'steps' ] )
-
-        RESPONSE.redirect( '%s/manage_importSteps?manage_tabs_message=%s'
-                         % ( self.absolute_url(), message )
-                         )
-
-    security.declareProtected( ManagePortal, 'manage_exportSteps' )
-    manage_exportSteps = PageTemplateFile( 'sutExportSteps', _wwwdir )
-
-    security.declareProtected( ManagePortal, 'manage_exportSelectedSteps' )
-    def manage_exportSelectedSteps( self, ids, RESPONSE ):
-
-        """ Export the steps selected by the user.
-        """
-        if not ids:
-            RESPONSE.redirect( '%s/manage_exportSteps?manage_tabs_message=%s'
-                             % ( self.absolute_url(), 'No+steps+selected.' )
-                             )
-
-        result = self._doRunExportSteps( ids )
-        RESPONSE.setHeader( 'Content-type', 'application/x-gzip')
-        RESPONSE.setHeader( 'Content-disposition'
-                          , 'attachment; filename=%s' % result[ 'filename' ]
-                          )
-        return result[ 'tarball' ]
-
-    security.declareProtected( ManagePortal, 'manage_exportAllSteps' )
-    def manage_exportAllSteps( self, RESPONSE ):
-
-        """ Export all steps.
-        """
-        result = self.runAllExportSteps()
-        RESPONSE.setHeader( 'Content-type', 'application/x-gzip')
-        RESPONSE.setHeader( 'Content-disposition'
-                          , 'attachment; filename=%s' % result[ 'filename' ]
-                          )
-        return result[ 'tarball' ]
-
-    security.declareProtected( ManagePortal, 'manage_snapshots' )
-    manage_snapshots = PageTemplateFile( 'sutSnapshots', _wwwdir )
-
-    security.declareProtected( ManagePortal, 'listSnapshotInfo' )
-    def listSnapshotInfo( self ):
-
-        """ Return a list of mappings describing available snapshots.
-
-        o Keys include:
-
-          'id' -- snapshot ID
-
-          'title' -- snapshot title or ID
-
-          'url' -- URL of the snapshot folder
-        """
-        result = []
-        snapshots = self._getOb( 'snapshots', None )
-
-        if snapshots:
-
-            for id, folder in snapshots.objectItems( 'Folder' ):
-
-                result.append( { 'id' : id
-                               , 'title' : folder.title_or_id()
-                               , 'url' : folder.absolute_url()
-                               } )
-        return result
-
-    security.declareProtected( ManagePortal, 'listProfileInfo' )
-    def listProfileInfo( self ):
-
-        """ Return a list of mappings describing registered profiles.
-
-        o Keys include:
-
-          'id' -- profile ID
-
-          'title' -- profile title or ID
-
-          'description' -- description of the profile
-
-          'path' -- path to the profile within its product
-
-          'product' -- name of the registering product
-        """
-        return _profile_registry.listProfileInfo()
-
-    security.declareProtected(ManagePortal, 'listContextInfos')
-    def listContextInfos(self):
-
-        """ List registered profiles and snapshots.
-        """
-
-        s_infos = [ { 'id': 'snapshot-%s' % info['id'],
-                      'title': info['title'] }
-                    for info in self.listSnapshotInfo() ]
-        p_infos = [ { 'id': 'profile-%s' % info['id'],
-                      'title': info['title'] }
-                    for info in self.listProfileInfo() ]
-
-        return tuple(s_infos + p_infos)
-
-    security.declareProtected( ManagePortal, 'manage_createSnapshot' )
-    def manage_createSnapshot( self, RESPONSE, snapshot_id=None ):
-
-        """ Create a snapshot with the given ID.
-
-        o If no ID is passed, generate one.
-        """
-        if snapshot_id is None:
-            timestamp = time.gmtime()
-            snapshot_id = 'snapshot-%4d%02d%02d%02d%02d%02d' % timestamp[:6]
-
-        self.createSnapshot( snapshot_id )
-
-        RESPONSE.redirect( '%s/manage_snapshots?manage_tabs_message=%s'
-                         % ( self.absolute_url(), 'Snapshot+created.' ) )
-
-    security.declareProtected( ManagePortal, 'manage_showDiff' )
-    manage_showDiff = PageTemplateFile( 'sutCompare', _wwwdir )
-
-    def manage_downloadDiff( self
-                           , lhs
-                           , rhs
-                           , missing_as_empty
-                           , ignore_blanks
-                           , RESPONSE
-                           ):
-        """ Crack request vars and call compareConfigurations.
-
-        o Return the result as a 'text/plain' stream, suitable for framing.
-        """
-        comparison = self.manage_compareConfigurations( lhs
-                                                      , rhs
-                                                      , missing_as_empty
-                                                      , ignore_blanks
-                                                      )
-        RESPONSE.setHeader( 'Content-Type', 'text/plain' )
-        return _PLAINTEXT_DIFF_HEADER % ( lhs, rhs, comparison )
-
-    security.declareProtected( ManagePortal, 'manage_compareConfigurations' )
-    def manage_compareConfigurations( self
-                                    , lhs
-                                    , rhs
-                                    , missing_as_empty
-                                    , ignore_blanks
-                                    ):
-        """ Crack request vars and call compareConfigurations.
-        """
-        lhs_context = self._getImportContext( lhs )
-        rhs_context = self._getImportContext( rhs )
-
-        return self.compareConfigurations( lhs_context
-                                         , rhs_context
-                                         , missing_as_empty
-                                         , ignore_blanks
-                                         )
-
-
-    #
-    #   Helper methods
-    #
-    security.declarePrivate( '_getProductPath' )
-    def _getProductPath( self, product_name ):
-
-        """ Return the absolute path of the product's directory.
-        """
-        try:
-            product = __import__( 'Products.%s' % product_name
-                                , globals(), {}, ['initialize' ] )
-        except ImportError:
-            raise ValueError, 'Not a valid product name: %s' % product_name
-
-        return product.__path__[0]
-
-    security.declarePrivate( '_getImportContext' )
-    def _getImportContext( self, context_id, should_purge=None ):
-
-        """ Crack ID and generate appropriate import context.
-        """
-        encoding = self.getEncoding()
-
-        if context_id.startswith( 'profile-' ):
-
-            context_id = context_id[ len( 'profile-' ): ]
-            info = _profile_registry.getProfileInfo( context_id )
-
-            if info.get( 'product' ):
-                path = os.path.join( self._getProductPath( info[ 'product' ] )
-                                   , info[ 'path' ] )
-            else:
-                path = info[ 'path' ]
-            if should_purge is None:
-                should_purge = (info.get('type') != EXTENSION)
-            return DirectoryImportContext(self, path, should_purge, encoding)
-
-        # else snapshot
-        context_id = context_id[ len( 'snapshot-' ): ]
-        if should_purge is None:
-            should_purge = True
-        return SnapshotImportContext(self, context_id, should_purge, encoding)
-
-    security.declarePrivate( '_updateImportStepsRegistry' )
-    def _updateImportStepsRegistry( self, encoding ):
-
-        """ Update our import steps registry from our profile.
-        """
-        context = self._getImportContext(self._import_context_id)
-        xml = context.readDataFile(IMPORT_STEPS_XML)
-        if xml is None:
-            return
-
-        info_list = self._import_registry.parseXML( xml, encoding )
-
-        for step_info in info_list:
-
-            id = step_info[ 'id' ]
-            version = step_info[ 'version' ]
-            handler = _resolveDottedName( step_info[ 'handler' ] )
-
-            dependencies = tuple( step_info.get( 'dependencies', () ) )
-            title = step_info.get( 'title', id )
-            description = ''.join( step_info.get( 'description', [] ) )
-
-            self._import_registry.registerStep( id=id
-                                              , version=version
-                                              , handler=handler
-                                              , dependencies=dependencies
-                                              , title=title
-                                              , description=description
-                                              )
-
-    security.declarePrivate( '_updateExportStepsRegistry' )
-    def _updateExportStepsRegistry( self, encoding ):
-
-        """ Update our export steps registry from our profile.
-        """
-        context = self._getImportContext(self._import_context_id)
-        xml = context.readDataFile(EXPORT_STEPS_XML)
-        if xml is None:
-            return
-
-        info_list = self._export_registry.parseXML( xml, encoding )
-
-        for step_info in info_list:
-
-            id = step_info[ 'id' ]
-            handler = _resolveDottedName( step_info[ 'handler' ] )
-
-            title = step_info.get( 'title', id )
-            description = ''.join( step_info.get( 'description', [] ) )
-
-            self._export_registry.registerStep( id=id
-                                              , handler=handler
-                                              , title=title
-                                              , description=description
-                                              )
-
-    security.declarePrivate( '_updateToolsetRegistry' )
-    def _updateToolsetRegistry( self, encoding ):
-
-        """ Update our toolset registry from our profile.
-        """
-        context = self._getImportContext(self._import_context_id)
-        xml = context.readDataFile(TOOLSET_XML)
-        if xml is None:
-            return
-
-        self._toolset_registry.parseXML( xml, encoding )
-
-    security.declarePrivate( '_doRunImportStep' )
-    def _doRunImportStep( self, step_id, context ):
-
-        """ Run a single import step, using a pre-built context.
-        """
-        handler = self._import_registry.getStep( step_id )
-
-        if handler is None:
-            raise ValueError( 'Invalid import step: %s' % step_id )
-
-        return handler( context )
-
-    security.declarePrivate( '_doRunExportSteps')
-    def _doRunExportSteps( self, steps ):
-
-        """ See ISetupTool.
-        """
-        context = TarballExportContext( self )
-        messages = {}
-
-        for step_id in steps:
-
-            handler = self._export_registry.getStep( step_id )
-
-            if handler is None:
-                raise ValueError( 'Invalid export step: %s' % step_id )
-
-            messages[ step_id ] = handler( context )
-
-
-        return { 'steps' : steps
-               , 'messages' : messages
-               , 'tarball' : context.getArchive()
-               , 'filename' : context.getArchiveFilename()
-               }
-
-InitializeClass( SetupTool )
-
-_PLAINTEXT_DIFF_HEADER ="""\
-Comparing configurations: '%s' and '%s'
-
-%s"""
+from Products.GenericSetup.tool import exportStepRegistries
+from Products.GenericSetup.tool import importToolset
+from Products.GenericSetup.tool import exportToolset
+from Products.GenericSetup.tool import SetupTool

Modified: CMF/trunk/CMFTopic/DateCriteria.py
===================================================================
--- CMF/trunk/CMFTopic/DateCriteria.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFTopic/DateCriteria.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -18,21 +18,26 @@
 from AccessControl import ClassSecurityInfo
 from DateTime.DateTime import DateTime
 from Globals import InitializeClass
+from zope.interface import implements
 
+from AbstractCriterion import AbstractCriterion
+from interfaces import Criterion as z2ICriterion
+from interfaces import ICriterion
+from permissions import ChangeTopics
 from permissions import View
-from permissions import ChangeTopics
-from AbstractCriterion import AbstractCriterion
-from interfaces import Criterion
 from Topic import Topic
 
 
 class FriendlyDateCriterion( AbstractCriterion ):
+
     """
         Put a friendly interface on date range searches, like
         'where effective date is less than 5 days old'.
     """
-    __implements__ = ( Criterion, )
 
+    implements(ICriterion)
+    __implements__ = z2ICriterion
+
     meta_type = 'Friendly Date Criterion'
 
     security = ClassSecurityInfo()

Modified: CMF/trunk/CMFTopic/ListCriterion.py
===================================================================
--- CMF/trunk/CMFTopic/ListCriterion.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFTopic/ListCriterion.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -14,24 +14,29 @@
 
 $Id$
 """
+
+from AccessControl import ClassSecurityInfo
 from Globals import InitializeClass
-from AccessControl import ClassSecurityInfo
+from zope.interface import implements
 
-
+from AbstractCriterion import AbstractCriterion
+from interfaces import Criterion as z2ICriterion
+from interfaces import ICriterion
+from permissions import ChangeTopics
 from permissions import View
-from permissions import ChangeTopics
-from AbstractCriterion import AbstractCriterion
-from interfaces import Criterion
 from Topic import Topic
 
 
 class ListCriterion( AbstractCriterion ):
+
     """
         Represent a criterion which is a list of values (for an
         'OR' search).
     """
-    __implements__ = ( Criterion, )
 
+    implements(ICriterion)
+    __implements__ = z2ICriterion
+
     meta_type = 'List Criterion'
     operator = None
     value = ( '', )
@@ -97,8 +102,6 @@
 
         return tuple( result )
 
-
-
 InitializeClass( ListCriterion )
 
 # Register as a criteria type with the Topic class

Modified: CMF/trunk/CMFTopic/SimpleIntCriterion.py
===================================================================
--- CMF/trunk/CMFTopic/SimpleIntCriterion.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFTopic/SimpleIntCriterion.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -17,21 +17,26 @@
 
 from AccessControl import ClassSecurityInfo
 from Globals import InitializeClass
+from zope.interface import implements
 
+from AbstractCriterion import AbstractCriterion
+from interfaces import Criterion as z2ICriterion
+from interfaces import ICriterion
+from permissions import ChangeTopics
 from permissions import View
-from permissions import ChangeTopics
-from AbstractCriterion import AbstractCriterion
-from interfaces import Criterion
 from Topic import Topic
 
 
 class SimpleIntCriterion( AbstractCriterion ):
+
     """
         Represent a simple field-match for an integer value, including
         catalog range searches.
     """
-    __implements__ = ( Criterion, )
 
+    implements(ICriterion)
+    __implements__ = z2ICriterion
+
     meta_type = 'Integer Criterion'
 
     security = ClassSecurityInfo()

Modified: CMF/trunk/CMFTopic/SimpleStringCriterion.py
===================================================================
--- CMF/trunk/CMFTopic/SimpleStringCriterion.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFTopic/SimpleStringCriterion.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -1,34 +1,40 @@
 ##############################################################################
 #
 # Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-# 
+#
 # This software is subject to the provisions of the Zope Public License,
 # Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
 # FOR A PARTICULAR PURPOSE.
-# 
+#
 ##############################################################################
 """ Simple string-matching criterion class
 
 $Id$
 """
+
+from AccessControl import ClassSecurityInfo
 from Globals import InitializeClass
-from AccessControl import ClassSecurityInfo
+from zope.interface import implements
 
+from AbstractCriterion import AbstractCriterion
+from interfaces import Criterion as z2ICriterion
+from interfaces import ICriterion
+from permissions import ChangeTopics
 from permissions import View
-from permissions import ChangeTopics
-from AbstractCriterion import AbstractCriterion
 from Topic import Topic
-from interfaces import Criterion
 
+
 class SimpleStringCriterion( AbstractCriterion ):
+
+    """ Represent a simple field-match for a string value.
     """
-        Represent a simple field-match for a string value.
-    """
-    __implements__ = ( Criterion, )
 
+    implements(ICriterion)
+    __implements__ = z2ICriterion
+
     meta_type = 'String Criterion'
 
     security = ClassSecurityInfo()

Modified: CMF/trunk/CMFTopic/SortCriterion.py
===================================================================
--- CMF/trunk/CMFTopic/SortCriterion.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFTopic/SortCriterion.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -1,35 +1,42 @@
 ##############################################################################
 #
 # Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-# 
+#
 # This software is subject to the provisions of the Zope Public License,
 # Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
 # FOR A PARTICULAR PURPOSE.
-# 
+#
 ##############################################################################
 """ Allow topic to specify sorting.
 
 $Id$
 """
+
+from AccessControl import ClassSecurityInfo
 from Globals import InitializeClass
-from AccessControl import ClassSecurityInfo
+from zope.interface import implements
 
+from AbstractCriterion import AbstractCriterion
+from interfaces import Criterion as z2ICriterion
+from interfaces import ICriterion
+from permissions import ChangeTopics
 from permissions import View
-from permissions import ChangeTopics
-from AbstractCriterion import AbstractCriterion
 from Topic import Topic
-from interfaces import Criterion
 
+
 class SortCriterion( AbstractCriterion ):
+
     """
         Represent a mock criterion, to allow spelling the sort order
         and reversal items in a catalog query.
     """
-    __implements__ = ( Criterion, )
 
+    implements(ICriterion)
+    __implements__ = z2ICriterion
+
     meta_type = 'Sort Criterion'
 
     security = ClassSecurityInfo()

Deleted: CMF/trunk/CMFTopic/configure.zcml
===================================================================
--- CMF/trunk/CMFTopic/configure.zcml	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFTopic/configure.zcml	2005-09-24 15:24:32 UTC (rev 38590)
@@ -1,36 +0,0 @@
-<configure
-    xmlns:five="http://namespaces.zope.org/five"
-    >
-
-  <five:bridge
-      zope2=".interfaces.Criterion.Criterion"
-      package=".interfaces"
-      name="ICriterion"
-      />
-
-  <five:implements
-      class=".DateCriteria.FriendlyDateCriterion"
-      interface=".interfaces.ICriterion"
-      />
-
-  <five:implements
-      class=".ListCriterion.ListCriterion"
-      interface=".interfaces.ICriterion"
-      />
-
-  <five:implements
-      class=".SimpleIntCriterion.SimpleIntCriterion"
-      interface=".interfaces.ICriterion"
-      />
-
-  <five:implements
-      class=".SimpleStringCriterion.SimpleStringCriterion"
-      interface=".interfaces.ICriterion"
-      />
-
-  <five:implements
-      class=".SortCriterion.SortCriterion"
-      interface=".interfaces.ICriterion"
-      />
-
-</configure>

Modified: CMF/trunk/CMFTopic/interfaces/Criterion.py
===================================================================
--- CMF/trunk/CMFTopic/interfaces/Criterion.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFTopic/interfaces/Criterion.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -16,68 +16,6 @@
 $Id$
 """
 
-from Interface import Interface
-
-
-class Criterion(Interface):
-    """\
-    A Topic is composed of Criterion objects which specify the query
-    used for the Topic.  By supplying some basic information, the
-    Criterion objects can be plugged into Topics without the Topic
-    having to be too aware of the Criteria types.
-    """
-
-    def Type():
-        """\
-        Return the type of criterion object this is (ie - 'List Criterion')
-        """
-
-    def Field():
-        """\
-        Return the field this criterion object searches on.
-        """
-
-    def Description():
-        """\
-        Return a brief description of the criteria type.
-        """
-
-    def editableAttributes():
-        """\
-        Returns a tuble of editable attributes.  The values of this
-        are used by the topic to build commands to send to the
-        'edit' method based on each criterion's setup.
-        """
-
-    def getEditForm():
-        """\
-        Return the name of a DTML component used to edit criterion.
-        Editforms should be specific to their type of criteria.
-        """
-
-    def apply(command):
-        """\
-        To make it easier to apply values from the rather dynamic
-        Criterion edit form using Python Scripts, apply takes a
-        mapping object as a default and applies itself to self.edit.
-
-        It's basically a nice and protected wrapper around
-        self.edit(**command).
-        """
-
-# XXX: Interfaces have to specify the signature.
-##    def edit(**kw):
-##        """\
-##        The signature of this method should be specific to the
-##        criterion.  Using the values in the attribute
-##        '_editableAttributes', the Topic can apply the right
-##        commands to each criteria object as its being edited without
-##        having to know too much about the structure.
-##        """
-
-    def getCriteriaItems():
-        """\
-        Return a sequence of key-value tuples, each representing
-        a value to be injected into the query dictionary (and,
-        therefore, tailored to work with the catalog).
-        """
+# BBB: module will be removed in CMF 2.2
+#      zope2 interfaces created on runtime:
+#      - Criterion

Modified: CMF/trunk/CMFTopic/interfaces/__init__.py
===================================================================
--- CMF/trunk/CMFTopic/interfaces/__init__.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFTopic/interfaces/__init__.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -1,17 +1,93 @@
 ##############################################################################
 #
 # Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-# 
+#
 # This software is subject to the provisions of the Zope Public License,
 # Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
 # FOR A PARTICULAR PURPOSE.
-# 
+#
 ##############################################################################
-"""\
-Loads interface names into the package.
+""" CMFTopic product interfaces.
+
+$Id$
 """
 
+from zope.interface import Interface
+
+
+class ICriterion(Interface):
+    """\
+    A Topic is composed of Criterion objects which specify the query
+    used for the Topic.  By supplying some basic information, the
+    Criterion objects can be plugged into Topics without the Topic
+    having to be too aware of the Criteria types.
+    """
+
+    def Type():
+        """\
+        Return the type of criterion object this is (ie - 'List Criterion')
+        """
+
+    def Field():
+        """\
+        Return the field this criterion object searches on.
+        """
+
+    def Description():
+        """\
+        Return a brief description of the criteria type.
+        """
+
+    def editableAttributes():
+        """\
+        Returns a tuble of editable attributes.  The values of this
+        are used by the topic to build commands to send to the
+        'edit' method based on each criterion's setup.
+        """
+
+    def getEditForm():
+        """\
+        Return the name of a DTML component used to edit criterion.
+        Editforms should be specific to their type of criteria.
+        """
+
+    def apply(command):
+        """\
+        To make it easier to apply values from the rather dynamic
+        Criterion edit form using Python Scripts, apply takes a
+        mapping object as a default and applies itself to self.edit.
+
+        It's basically a nice and protected wrapper around
+        self.edit(**command).
+        """
+
+# XXX: Interfaces have to specify the signature.
+##    def edit(**kw):
+##        """\
+##        The signature of this method should be specific to the
+##        criterion.  Using the values in the attribute
+##        '_editableAttributes', the Topic can apply the right
+##        commands to each criteria object as its being edited without
+##        having to know too much about the structure.
+##        """
+
+    def getCriteriaItems():
+        """\
+        Return a sequence of key-value tuples, each representing
+        a value to be injected into the query dictionary (and,
+        therefore, tailored to work with the catalog).
+        """
+
+
+# BBB: will be removed in CMF 2.2
+#      create zope2 interfaces
+from Interface.bridge import createZope3Bridge
+import Criterion
+
+createZope3Bridge(ICriterion, Criterion, 'Criterion')
+
 from Criterion import Criterion
+del createZope3Bridge

Modified: CMF/trunk/CMFUid/UniqueIdAnnotationTool.py
===================================================================
--- CMF/trunk/CMFUid/UniqueIdAnnotationTool.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFUid/UniqueIdAnnotationTool.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -17,13 +17,14 @@
 $Id$
 """
 
-from Globals import InitializeClass, Persistent
 from AccessControl import ClassSecurityInfo
 from Acquisition import aq_base, aq_inner, aq_parent
 from Acquisition import Implicit
-
+from Globals import InitializeClass
+from Globals import Persistent
 from OFS.PropertyManager import PropertyManager
 from OFS.SimpleItem import SimpleItem
+from zope.interface import implements
 
 from Products.CMFCore.utils import getToolByName, UniqueObject
 from Products.CMFCore.ActionProviderBase import ActionProviderBase
@@ -33,12 +34,11 @@
 
 
 class UniqueIdAnnotation(Persistent, Implicit):
+
     """Unique id object used as annotation on (content) objects.
     """
 
-    __implements__ = (
-        IUniqueIdAnnotation,
-    )
+    implements(IUniqueIdAnnotation)
 
     def __init__(self, obj, id):
         """See IUniqueIdAnnotation.
@@ -106,11 +106,13 @@
 InitializeClass(UniqueIdAnnotation)
 
 
-class UniqueIdAnnotationTool(UniqueObject, SimpleItem, PropertyManager, ActionProviderBase):
+class UniqueIdAnnotationTool(UniqueObject, SimpleItem, PropertyManager,
+                             ActionProviderBase):
+
     __doc__ = __doc__ # copy from module
 
+    implements(IUniqueIdAnnotationManagement)
     __implements__ = (
-        IUniqueIdAnnotationManagement,
         ActionProviderBase.__implements__,
         SimpleItem.__implements__,
     )

Modified: CMF/trunk/CMFUid/UniqueIdGeneratorTool.py
===================================================================
--- CMF/trunk/CMFUid/UniqueIdGeneratorTool.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFUid/UniqueIdGeneratorTool.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -21,6 +21,7 @@
 from BTrees.Length import Length
 from Globals import InitializeClass
 from OFS.SimpleItem import SimpleItem
+from zope.interface import implements
 
 from Products.CMFCore.ActionProviderBase import ActionProviderBase
 from Products.CMFCore.utils import UniqueObject
@@ -28,14 +29,15 @@
 
 
 class UniqueIdGeneratorTool(UniqueObject, SimpleItem, ActionProviderBase):
+
     """Generator of unique ids.
     
     This is a dead simple implementation using a counter. May cause
     ConflictErrors under high load and the values are predictable.
     """
 
+    implements(IUniqueIdGenerator)
     __implements__ = (
-        IUniqueIdGenerator,
         ActionProviderBase.__implements__,
         SimpleItem.__implements__,
     )

Modified: CMF/trunk/CMFUid/UniqueIdHandlerTool.py
===================================================================
--- CMF/trunk/CMFUid/UniqueIdHandlerTool.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFUid/UniqueIdHandlerTool.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -16,8 +16,8 @@
 
 $Id$
 """
+
 import os
-
 import Missing
 
 import zLOG
@@ -27,6 +27,7 @@
 from Globals import package_home
 from OFS.SimpleItem import SimpleItem
 from Products.PageTemplates.PageTemplateFile import PageTemplateFile
+from zope.interface import implements
 
 from Products.CMFCore.ActionProviderBase import ActionProviderBase
 from Products.CMFCore.permissions import ManagePortal
@@ -42,14 +43,14 @@
 
 _wwwdir = os.path.join( package_home( globals() ), 'www' )
 
+
 class UniqueIdHandlerTool(UniqueObject, SimpleItem, ActionProviderBase):
 
     __doc__ = __doc__ # copy from module
 
+    implements(IUniqueIdHandler, IUniqueIdBrainQuery,
+               IUniqueIdUnrestrictedQuery)
     __implements__ = (
-        IUniqueIdHandler,
-        IUniqueIdBrainQuery,
-        IUniqueIdUnrestrictedQuery,
         ActionProviderBase.__implements__,
         SimpleItem.__implements__,
     )

Modified: CMF/trunk/CMFUid/interfaces.py
===================================================================
--- CMF/trunk/CMFUid/interfaces.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFUid/interfaces.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -19,10 +19,11 @@
 $Id$
 """
 
-from Interface import Interface
+from zope.interface import Interface
+from zope.interface import Attribute
 
-from Products.CMFCore.interfaces.IOpaqueItems import ICallableOpaqueItem
-from Products.CMFCore.interfaces.IOpaqueItems import ICallableOpaqueItemEvents
+from Products.CMFCore.interfaces import ICallableOpaqueItem
+from Products.CMFCore.interfaces import ICallableOpaqueItemEvents
 
 
 class UniqueIdError(Exception):

Modified: CMF/trunk/CMFUid/tests/test_uidannotation.py
===================================================================
--- CMF/trunk/CMFUid/tests/test_uidannotation.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFUid/tests/test_uidannotation.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -15,40 +15,39 @@
 $Id$
 """
 
-from unittest import TestSuite, makeSuite, main
+import unittest
 import Testing
-import Zope2
-Zope2.startup()
 
-from Interface.Verify import verifyObject
-
 from Products.CMFCore.PortalFolder import PortalFolder
 from Products.CMFCore.tests.base.dummy import DummyContent
 from Products.CMFCore.tests.base.testcase import SecurityTest
 
-from Products.CMFUid.interfaces import IUniqueIdAnnotation
-from Products.CMFUid.interfaces import IUniqueIdAnnotationManagement
 
-
 UID_ATTRNAME = 'cmf_uid'
 
-class UniqueIdAnnotationTests(SecurityTest):
 
-    def setUp(self):
+class UniqueIdAnnotationToolTests(SecurityTest):
+
+    def _getTargetClass(self):
         from Products.CMFUid.UniqueIdAnnotationTool \
                 import UniqueIdAnnotationTool
 
+        return UniqueIdAnnotationTool
+
+    def setUp(self):
         SecurityTest.setUp(self)
-        self.root._setObject('portal_uidannotation', UniqueIdAnnotationTool())
+        self.root._setObject('portal_uidannotation', self._getTargetClass()())
         self.root._setObject('dummy', DummyContent(id='dummy'))
 
-    def test_interface(self):
-        dummy = self.root.dummy
-        anno_tool = self.root.portal_uidannotation
-        annotation = anno_tool(dummy, UID_ATTRNAME)
+    def test_z3interfaces(self):
+        from zope.interface.verify import verifyClass
+        from Products.CMFUid.interfaces import IUniqueIdAnnotation
+        from Products.CMFUid.interfaces import IUniqueIdAnnotationManagement
+        from Products.CMFUid.UniqueIdAnnotationTool \
+                import UniqueIdAnnotation
 
-        verifyObject(IUniqueIdAnnotationManagement, anno_tool)
-        verifyObject(IUniqueIdAnnotation, annotation)
+        verifyClass(IUniqueIdAnnotationManagement, self._getTargetClass())
+        verifyClass(IUniqueIdAnnotation, UniqueIdAnnotation)
 
     def test_setAndGetUid(self):
         dummy = self.root.dummy
@@ -136,9 +135,9 @@
 
 
 def test_suite():
-    return TestSuite((
-        makeSuite(UniqueIdAnnotationTests),
+    return unittest.TestSuite((
+        unittest.makeSuite(UniqueIdAnnotationToolTests),
         ))
 
 if __name__ == '__main__':
-    main(defaultTest='test_suite')
+    unittest.main(defaultTest='test_suite')

Modified: CMF/trunk/CMFUid/tests/test_uidgeneration.py
===================================================================
--- CMF/trunk/CMFUid/tests/test_uidgeneration.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFUid/tests/test_uidgeneration.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -19,24 +19,28 @@
 import Testing
 
 from BTrees.Length import Length
-from Interface.Verify import verifyObject
 
 from Products.CMFCore.tests.base.testcase import SecurityTest
 
-from Products.CMFUid.interfaces import IUniqueIdGenerator
-from Products.CMFUid.UniqueIdGeneratorTool import UniqueIdGeneratorTool
 
+class UniqueIdGeneratorToolTests(SecurityTest):
 
-class UniqueIdGeneratorTests(SecurityTest):
+    def _getTargetClass(self):
+        from Products.CMFUid.UniqueIdGeneratorTool \
+                import UniqueIdGeneratorTool
 
+        return UniqueIdGeneratorTool
+
     def setUp(self):
         SecurityTest.setUp(self)
-        self.root._setObject('portal_uidgenerator', UniqueIdGeneratorTool())
+        self.root._setObject('portal_uidgenerator', self._getTargetClass()())
 
-    def test_interface(self):
-        generator = self.root.portal_uidgenerator
-        verifyObject(IUniqueIdGenerator, generator)
+    def test_z3interfaces(self):
+        from zope.interface.verify import verifyClass
+        from Products.CMFUid.interfaces import IUniqueIdGenerator
 
+        verifyClass(IUniqueIdGenerator, self._getTargetClass())
+
     def test_returnedUidsAreValidAndDifferent(self):
         generator = self.root.portal_uidgenerator
         uid1 = generator()
@@ -66,7 +70,7 @@
 
 def test_suite():
     return unittest.TestSuite((
-        unittest.makeSuite(UniqueIdGeneratorTests),
+        unittest.makeSuite(UniqueIdGeneratorToolTests),
         ))
 
 if __name__ == '__main__':

Modified: CMF/trunk/CMFUid/tests/test_uidhandling.py
===================================================================
--- CMF/trunk/CMFUid/tests/test_uidhandling.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/CMFUid/tests/test_uidhandling.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -18,22 +18,12 @@
 import unittest
 import Testing
 
-from Interface.Verify import verifyObject
-
-from Products.CMFCore.CatalogTool import CatalogTool
 from Products.CMFCore.tests.base.dummy import DummyContent
 from Products.CMFCore.tests.base.dummy import DummyFolder
 from Products.CMFCore.tests.base.dummy import DummySite
 from Products.CMFCore.tests.base.testcase import SecurityTest
 
-from Products.CMFUid.interfaces import IUniqueIdBrainQuery
-from Products.CMFUid.interfaces import IUniqueIdHandler
-from Products.CMFUid.interfaces import IUniqueIdUnrestrictedQuery
-from Products.CMFUid.UniqueIdAnnotationTool import UniqueIdAnnotationTool
-from Products.CMFUid.UniqueIdGeneratorTool import UniqueIdGeneratorTool
-from Products.CMFUid.UniqueIdHandlerTool import UniqueIdHandlerTool
 
-
 def removeUnnecessaryIndexes(catalog):
     indexes = [id[0] for id in catalog.enumerateIndexes()]
     columns = catalog.enumerateColumns()
@@ -49,22 +39,35 @@
 
 class UniqueIdHandlerTests(SecurityTest):
 
+    def _getTargetClass(self):
+        from Products.CMFUid.UniqueIdHandlerTool import UniqueIdHandlerTool
+
+        return UniqueIdHandlerTool
+
     def setUp(self):
+        from Products.CMFCore.CatalogTool import CatalogTool
+        from Products.CMFUid.UniqueIdAnnotationTool \
+                import UniqueIdAnnotationTool
+        from Products.CMFUid.UniqueIdGeneratorTool \
+                import UniqueIdGeneratorTool
         SecurityTest.setUp(self)
         self.root._setObject('portal_catalog', CatalogTool())
         self.root._setObject('portal_uidgenerator', UniqueIdGeneratorTool())
         self.root._setObject('portal_uidannotation', UniqueIdAnnotationTool())
-        self.root._setObject('portal_uidhandler', UniqueIdHandlerTool())
+        self.root._setObject('portal_uidhandler', self._getTargetClass()())
         self.root._setObject('dummy', DummyContent(id='dummy'))
         self.root._setObject('dummy2', DummyContent(id='dummy2'))
 
         removeUnnecessaryIndexes(self.root.portal_catalog)
 
-    def test_interface(self):
-        handler = self.root.portal_uidhandler
-        verifyObject(IUniqueIdHandler, handler)
-        verifyObject(IUniqueIdBrainQuery, handler)
-        verifyObject(IUniqueIdUnrestrictedQuery, handler)
+    def test_z3interfaces(self):
+        from zope.interface.verify import verifyClass
+        from Products.CMFUid.interfaces import IUniqueIdBrainQuery
+        from Products.CMFUid.interfaces import IUniqueIdHandler
+        from Products.CMFUid.interfaces import IUniqueIdUnrestrictedQuery
+        verifyClass(IUniqueIdHandler, self._getTargetClass())
+        verifyClass(IUniqueIdBrainQuery, self._getTargetClass())
+        verifyClass(IUniqueIdUnrestrictedQuery, self._getTargetClass())
 
     def test_getUidOfNotYetRegisteredObject(self):
         handler = self.root.portal_uidhandler

Modified: CMF/trunk/DCWorkflow/DCWorkflow.py
===================================================================
--- CMF/trunk/DCWorkflow/DCWorkflow.py	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/DCWorkflow/DCWorkflow.py	2005-09-24 15:24:32 UTC (rev 38590)
@@ -25,10 +25,12 @@
 from Globals import InitializeClass
 from OFS.Folder import Folder
 from OFS.ObjectManager import bad_id
+from zope.interface import implements
 
 # CMFCore
+from Products.CMFCore.interfaces import IWorkflowDefinition
 from Products.CMFCore.interfaces.portal_workflow \
-        import WorkflowDefinition as IWorkflowDefinition
+        import WorkflowDefinition as z2IWorkflowDefinition
 from Products.CMFCore.utils import getToolByName
 from Products.CMFCore.WorkflowCore import ObjectDeleted
 from Products.CMFCore.WorkflowCore import ObjectMoved
@@ -53,14 +55,16 @@
     return 1
 
 
-class DCWorkflowDefinition (WorkflowUIMixin, Folder):
+class DCWorkflowDefinition(WorkflowUIMixin, Folder):
+
     '''
     This class is the workflow engine and the container for the
     workflow definition.
     UI methods are in WorkflowUIMixin.
     '''
 
-    __implements__ = IWorkflowDefinition
+    implements(IWorkflowDefinition)
+    __implements__ = z2IWorkflowDefinition
 
     meta_type = 'Workflow'
     title = 'DC Workflow Definition'

Deleted: CMF/trunk/DCWorkflow/configure.zcml
===================================================================
--- CMF/trunk/DCWorkflow/configure.zcml	2005-09-24 15:01:23 UTC (rev 38589)
+++ CMF/trunk/DCWorkflow/configure.zcml	2005-09-24 15:24:32 UTC (rev 38590)
@@ -1,10 +0,0 @@
-<configure
-    xmlns:five="http://namespaces.zope.org/five"
-    >
-
-  <five:implements
-      class=".DCWorkflow.DCWorkflowDefinition"
-      interface="Products.CMFCore.interfaces.IWorkflowDefinition"
-      />
-
-</configure>

Copied: CMF/trunk/GenericSetup (from rev 38589, CMF/branches/goldegg-phase-1/GenericSetup)



More information about the CMF-checkins mailing list