[Checkins] SVN: GenericSetup/trunk/ - removed obsolete BBB code

Yvo Schubbe y.2006_ at wcm-solutions.de
Mon Nov 20 06:03:31 EST 2006


Log message for revision 71199:
  - removed obsolete BBB code
  - some related cleanup

Changed:
  U   GenericSetup/trunk/MailHost/configure.zcml
  U   GenericSetup/trunk/MailHost/exportimport.py
  U   GenericSetup/trunk/OFSP/configure.zcml
  U   GenericSetup/trunk/OFSP/exportimport.py
  U   GenericSetup/trunk/OFSP/tests/test_exportimport.py
  U   GenericSetup/trunk/PageTemplates/configure.zcml
  U   GenericSetup/trunk/PageTemplates/exportimport.py
  U   GenericSetup/trunk/PluginIndexes/configure.zcml
  U   GenericSetup/trunk/PluginIndexes/exportimport.py
  U   GenericSetup/trunk/PythonScripts/configure.zcml
  U   GenericSetup/trunk/PythonScripts/exportimport.py
  U   GenericSetup/trunk/ZCTextIndex/configure.zcml
  U   GenericSetup/trunk/ZCTextIndex/exportimport.py
  U   GenericSetup/trunk/ZCatalog/configure.zcml
  U   GenericSetup/trunk/ZCatalog/exportimport.py
  U   GenericSetup/trunk/components.py
  U   GenericSetup/trunk/rolemap.py
  U   GenericSetup/trunk/testing.py
  U   GenericSetup/trunk/tests/common.py
  U   GenericSetup/trunk/tests/faux_objects.py
  U   GenericSetup/trunk/tests/test_components.py
  U   GenericSetup/trunk/tests/test_content.py
  U   GenericSetup/trunk/tests/test_rolemap.py
  U   GenericSetup/trunk/tests/test_zcml.py
  U   GenericSetup/trunk/utils.py

-=-
Modified: GenericSetup/trunk/MailHost/configure.zcml
===================================================================
--- GenericSetup/trunk/MailHost/configure.zcml	2006-11-20 09:51:45 UTC (rev 71198)
+++ GenericSetup/trunk/MailHost/configure.zcml	2006-11-20 11:03:29 UTC (rev 71199)
@@ -1,12 +1,6 @@
 <configure
-    xmlns="http://namespaces.zope.org/zope"
-    >
+    xmlns="http://namespaces.zope.org/zope">
 
-  <adapter
-      factory=".exportimport.MailHostXMLAdapter"
-      provides="Products.GenericSetup.interfaces.IBody"
-      for="Products.MailHost.interfaces.IMailHost
-           Products.GenericSetup.interfaces.ISetupEnviron"
-      />
+  <adapter factory=".exportimport.MailHostXMLAdapter"/>
 
 </configure>

Modified: GenericSetup/trunk/MailHost/exportimport.py
===================================================================
--- GenericSetup/trunk/MailHost/exportimport.py	2006-11-20 09:51:45 UTC (rev 71198)
+++ GenericSetup/trunk/MailHost/exportimport.py	2006-11-20 11:03:29 UTC (rev 71199)
@@ -15,6 +15,9 @@
 $Id$
 """
 
+from zope.component import adapts
+
+from Products.GenericSetup.interfaces import ISetupEnviron
 from Products.GenericSetup.utils import XMLAdapterBase
 
 from Products.MailHost.interfaces import IMailHost
@@ -25,7 +28,7 @@
     """XML im- and exporter for MailHost.
     """
 
-    __used_for__ = IMailHost
+    adapts(IMailHost, ISetupEnviron)
 
     _LOGGER_ID = 'mailhost'
 

Modified: GenericSetup/trunk/OFSP/configure.zcml
===================================================================
--- GenericSetup/trunk/OFSP/configure.zcml	2006-11-20 09:51:45 UTC (rev 71198)
+++ GenericSetup/trunk/OFSP/configure.zcml	2006-11-20 11:03:29 UTC (rev 71199)
@@ -1,12 +1,6 @@
 <configure
-    xmlns="http://namespaces.zope.org/zope"
-    >
+    xmlns="http://namespaces.zope.org/zope">
 
-  <adapter
-      factory=".exportimport.FolderXMLAdapter"
-      provides="Products.GenericSetup.interfaces.IBody"
-      for="OFS.interfaces.IFolder
-           Products.GenericSetup.interfaces.ISetupEnviron"
-      />
+  <adapter factory=".exportimport.FolderXMLAdapter"/>
 
 </configure>

Modified: GenericSetup/trunk/OFSP/exportimport.py
===================================================================
--- GenericSetup/trunk/OFSP/exportimport.py	2006-11-20 09:51:45 UTC (rev 71198)
+++ GenericSetup/trunk/OFSP/exportimport.py	2006-11-20 11:03:29 UTC (rev 71199)
@@ -15,6 +15,9 @@
 $Id$
 """
 
+from zope.component import adapts
+
+from Products.GenericSetup.interfaces import ISetupEnviron
 from Products.GenericSetup.utils import XMLAdapterBase
 from Products.GenericSetup.utils import ObjectManagerHelpers
 from Products.GenericSetup.utils import PropertyManagerHelpers
@@ -28,7 +31,7 @@
     """XML im- and exporter for Folder.
     """
 
-    __used_for__ = IFolder
+    adapts(IFolder, ISetupEnviron)
 
     _LOGGER_ID = 'ofs'
 

Modified: GenericSetup/trunk/OFSP/tests/test_exportimport.py
===================================================================
--- GenericSetup/trunk/OFSP/tests/test_exportimport.py	2006-11-20 09:51:45 UTC (rev 71198)
+++ GenericSetup/trunk/OFSP/tests/test_exportimport.py	2006-11-20 11:03:29 UTC (rev 71199)
@@ -49,12 +49,6 @@
         from OFS.Folder import Folder
 
         BodyAdapterTestCase.setUp(self)
-        try:
-            #BBB: for Zope 2.8
-            import Products.Five
-            zcml.load_config('interfaces.zcml', Products.Five)
-        except IOError:
-            pass
         zcml.load_config('configure.zcml', Products.GenericSetup.OFSP)
 
         self._obj = Folder('foo_folder')

Modified: GenericSetup/trunk/PageTemplates/configure.zcml
===================================================================
--- GenericSetup/trunk/PageTemplates/configure.zcml	2006-11-20 09:51:45 UTC (rev 71198)
+++ GenericSetup/trunk/PageTemplates/configure.zcml	2006-11-20 11:03:29 UTC (rev 71199)
@@ -1,14 +1,8 @@
 <configure
     xmlns="http://namespaces.zope.org/zope"
-    xmlns:five="http://namespaces.zope.org/five"
-    >
+    xmlns:five="http://namespaces.zope.org/five">
 
-  <adapter
-      factory=".exportimport.ZopePageTemplateBodyAdapter"
-      provides="Products.GenericSetup.interfaces.IBody"
-      for=".interfaces.IZopePageTemplate
-           Products.GenericSetup.interfaces.ISetupEnviron"
-      />
+  <adapter factory=".exportimport.ZopePageTemplateBodyAdapter"/>
 
   <five:implements
       class="Products.PageTemplates.ZopePageTemplate.ZopePageTemplate"

Modified: GenericSetup/trunk/PageTemplates/exportimport.py
===================================================================
--- GenericSetup/trunk/PageTemplates/exportimport.py	2006-11-20 09:51:45 UTC (rev 71198)
+++ GenericSetup/trunk/PageTemplates/exportimport.py	2006-11-20 11:03:29 UTC (rev 71199)
@@ -15,6 +15,9 @@
 $Id$
 """
 
+from zope.component import adapts
+
+from Products.GenericSetup.interfaces import ISetupEnviron
 from Products.GenericSetup.utils import BodyAdapterBase
 
 from interfaces import IZopePageTemplate
@@ -25,7 +28,7 @@
     """Body im- and exporter for ZopePageTemplate.
     """
 
-    __used_for__ = IZopePageTemplate
+    adapts(IZopePageTemplate, ISetupEnviron)
 
     def _exportBody(self):
         """Export the object as a file body.

Modified: GenericSetup/trunk/PluginIndexes/configure.zcml
===================================================================
--- GenericSetup/trunk/PluginIndexes/configure.zcml	2006-11-20 09:51:45 UTC (rev 71198)
+++ GenericSetup/trunk/PluginIndexes/configure.zcml	2006-11-20 11:03:29 UTC (rev 71199)
@@ -1,61 +1,20 @@
 <configure
-    xmlns="http://namespaces.zope.org/zope"
-    >
+    xmlns="http://namespaces.zope.org/zope">
 
-  <adapter
-      factory=".exportimport.PluggableIndexNodeAdapter"
-      provides="Products.GenericSetup.interfaces.INode"
-      for="Products.PluginIndexes.interfaces.IPluggableIndex
-           Products.GenericSetup.interfaces.ISetupEnviron"
-      />
+  <adapter factory=".exportimport.PluggableIndexNodeAdapter"/>
 
-  <adapter
-      factory=".exportimport.DateIndexNodeAdapter"
-      provides="Products.GenericSetup.interfaces.INode"
-      for="Products.PluginIndexes.interfaces.IDateIndex
-           Products.GenericSetup.interfaces.ISetupEnviron"
-      />
+  <adapter factory=".exportimport.DateIndexNodeAdapter"/>
 
-  <adapter
-      factory=".exportimport.DateRangeIndexNodeAdapter"
-      provides="Products.GenericSetup.interfaces.INode"
-      for="Products.PluginIndexes.interfaces.IDateRangeIndex
-           Products.GenericSetup.interfaces.ISetupEnviron"
-      />
+  <adapter factory=".exportimport.DateRangeIndexNodeAdapter"/>
 
-  <adapter
-      factory=".exportimport.PathIndexNodeAdapter"
-      provides="Products.GenericSetup.interfaces.INode"
-      for="Products.PluginIndexes.interfaces.IPathIndex
-           Products.GenericSetup.interfaces.ISetupEnviron"
-      />
+  <adapter factory=".exportimport.PathIndexNodeAdapter"/>
 
-  <adapter
-      factory=".exportimport.VocabularyNodeAdapter"
-      provides="Products.GenericSetup.interfaces.INode"
-      for="Products.PluginIndexes.interfaces.IVocabulary
-           Products.GenericSetup.interfaces.ISetupEnviron"
-      />
+  <adapter factory=".exportimport.VocabularyNodeAdapter"/>
 
-  <adapter
-      factory=".exportimport.TextIndexNodeAdapter"
-      provides="Products.GenericSetup.interfaces.INode"
-      for="Products.PluginIndexes.interfaces.ITextIndex
-           Products.GenericSetup.interfaces.ISetupEnviron"
-      />
+  <adapter factory=".exportimport.TextIndexNodeAdapter"/>
 
-  <adapter
-      factory=".exportimport.FilteredSetNodeAdapter"
-      provides="Products.GenericSetup.interfaces.INode"
-      for="Products.PluginIndexes.interfaces.IFilteredSet
-           Products.GenericSetup.interfaces.ISetupEnviron"
-      />
+  <adapter factory=".exportimport.FilteredSetNodeAdapter"/>
 
-  <adapter
-      factory=".exportimport.TopicIndexNodeAdapter"
-      provides="Products.GenericSetup.interfaces.INode"
-      for="Products.PluginIndexes.interfaces.ITopicIndex
-           Products.GenericSetup.interfaces.ISetupEnviron"
-      />
+  <adapter factory=".exportimport.TopicIndexNodeAdapter"/>
 
 </configure>

Modified: GenericSetup/trunk/PluginIndexes/exportimport.py
===================================================================
--- GenericSetup/trunk/PluginIndexes/exportimport.py	2006-11-20 09:51:45 UTC (rev 71198)
+++ GenericSetup/trunk/PluginIndexes/exportimport.py	2006-11-20 11:03:29 UTC (rev 71199)
@@ -15,9 +15,11 @@
 $Id$
 """
 
+from zope.component import adapts
 from zope.component import queryMultiAdapter
 
 from Products.GenericSetup.interfaces import INode
+from Products.GenericSetup.interfaces import ISetupEnviron
 from Products.GenericSetup.utils import NodeAdapterBase
 from Products.GenericSetup.utils import PropertyManagerHelpers
 
@@ -36,7 +38,7 @@
     """Node im- and exporter for FieldIndex, KeywordIndex.
     """
 
-    __used_for__ = IPluggableIndex
+    adapts(IPluggableIndex, ISetupEnviron)
 
     def _exportNode(self):
         """Export the object as a DOM node.
@@ -67,7 +69,7 @@
     """Node im- and exporter for DateIndex.
     """
 
-    __used_for__ = IDateIndex
+    adapts(IDateIndex, ISetupEnviron)
 
     def _exportNode(self):
         """Export the object as a DOM node.
@@ -93,7 +95,7 @@
     """Node im- and exporter for DateRangeIndex.
     """
 
-    __used_for__ = IDateRangeIndex
+    adapts(IDateRangeIndex, ISetupEnviron)
 
     def _exportNode(self):
         """Export the object as a DOM node.
@@ -118,7 +120,7 @@
     """Node im- and exporter for PathIndex.
     """
 
-    __used_for__ = IPathIndex
+    adapts(IPathIndex, ISetupEnviron)
 
     def _exportNode(self):
         """Export the object as a DOM node.
@@ -133,7 +135,7 @@
     """Node im- and exporter for Vocabulary.
     """
 
-    __used_for__ = IVocabulary
+    adapts(IVocabulary, ISetupEnviron)
 
     def _exportNode(self):
         """Export the object as a DOM node.
@@ -150,7 +152,7 @@
     """Node im- and exporter for TextIndex.
     """
 
-    __used_for__ = ITextIndex
+    adapts(ITextIndex, ISetupEnviron)
 
     def _exportNode(self):
         """Export the object as a DOM node.
@@ -167,7 +169,7 @@
     """Node im- and exporter for FilteredSet.
     """
 
-    __used_for__ = IFilteredSet
+    adapts(IFilteredSet, ISetupEnviron)
 
     def _exportNode(self):
         """Export the object as a DOM node.
@@ -191,7 +193,7 @@
     """Node im- and exporter for TopicIndex.
     """
 
-    __used_for__ = ITopicIndex
+    adapts(ITopicIndex, ISetupEnviron)
 
     def _exportNode(self):
         """Export the object as a DOM node.

Modified: GenericSetup/trunk/PythonScripts/configure.zcml
===================================================================
--- GenericSetup/trunk/PythonScripts/configure.zcml	2006-11-20 09:51:45 UTC (rev 71198)
+++ GenericSetup/trunk/PythonScripts/configure.zcml	2006-11-20 11:03:29 UTC (rev 71199)
@@ -1,14 +1,8 @@
 <configure
     xmlns="http://namespaces.zope.org/zope"
-    xmlns:five="http://namespaces.zope.org/five"
-    >
+    xmlns:five="http://namespaces.zope.org/five">
 
-  <adapter
-      factory=".exportimport.PythonScriptBodyAdapter"
-      provides="Products.GenericSetup.interfaces.IBody"
-      for=".interfaces.IPythonScript
-           Products.GenericSetup.interfaces.ISetupEnviron"
-      />
+  <adapter factory=".exportimport.PythonScriptBodyAdapter"/>
 
   <five:implements
       class="Products.PythonScripts.PythonScript.PythonScript"

Modified: GenericSetup/trunk/PythonScripts/exportimport.py
===================================================================
--- GenericSetup/trunk/PythonScripts/exportimport.py	2006-11-20 09:51:45 UTC (rev 71198)
+++ GenericSetup/trunk/PythonScripts/exportimport.py	2006-11-20 11:03:29 UTC (rev 71199)
@@ -15,6 +15,9 @@
 $Id$
 """
 
+from zope.component import adapts
+
+from Products.GenericSetup.interfaces import ISetupEnviron
 from Products.GenericSetup.utils import BodyAdapterBase
 
 from interfaces import IPythonScript
@@ -25,7 +28,7 @@
     """Body im- and exporter for PythonScript.
     """
 
-    __used_for__ = IPythonScript
+    adapts(IPythonScript, ISetupEnviron)
 
     def _exportBody(self):
         """Export the object as a file body.

Modified: GenericSetup/trunk/ZCTextIndex/configure.zcml
===================================================================
--- GenericSetup/trunk/ZCTextIndex/configure.zcml	2006-11-20 09:51:45 UTC (rev 71198)
+++ GenericSetup/trunk/ZCTextIndex/configure.zcml	2006-11-20 11:03:29 UTC (rev 71199)
@@ -1,19 +1,8 @@
 <configure
-    xmlns="http://namespaces.zope.org/zope"
-    >
+    xmlns="http://namespaces.zope.org/zope">
 
-  <adapter
-      factory=".exportimport.ZCLexiconNodeAdapter"
-      provides="Products.GenericSetup.interfaces.INode"
-      for="Products.ZCTextIndex.interfaces.IZCLexicon
-           Products.GenericSetup.interfaces.ISetupEnviron"
-      />
+  <adapter factory=".exportimport.ZCLexiconNodeAdapter"/>
 
-  <adapter
-      factory=".exportimport.ZCTextIndexNodeAdapter"
-      provides="Products.GenericSetup.interfaces.INode"
-      for="Products.ZCTextIndex.interfaces.IZCTextIndex
-           Products.GenericSetup.interfaces.ISetupEnviron"
-      />
+  <adapter factory=".exportimport.ZCTextIndexNodeAdapter"/>
 
 </configure>

Modified: GenericSetup/trunk/ZCTextIndex/exportimport.py
===================================================================
--- GenericSetup/trunk/ZCTextIndex/exportimport.py	2006-11-20 09:51:45 UTC (rev 71198)
+++ GenericSetup/trunk/ZCTextIndex/exportimport.py	2006-11-20 11:03:29 UTC (rev 71199)
@@ -18,7 +18,9 @@
 from BTrees.IOBTree import IOBTree
 from BTrees.Length import Length
 from BTrees.OIBTree import OIBTree
+from zope.component import adapts
 
+from Products.GenericSetup.interfaces import ISetupEnviron
 from Products.GenericSetup.utils import NodeAdapterBase
 
 from Products.ZCTextIndex.interfaces import IZCLexicon
@@ -31,7 +33,7 @@
     """Node im- and exporter for ZCTextIndex Lexicon.
     """
 
-    __used_for__ = IZCLexicon
+    adapts(IZCLexicon, ISetupEnviron)
 
     def _exportNode(self):
         """Export the object as a DOM node.
@@ -75,7 +77,7 @@
     """Node im- and exporter for ZCTextIndex.
     """
 
-    __used_for__ = IZCTextIndex
+    adapts(IZCTextIndex, ISetupEnviron)
 
     def _exportNode(self):
         """Export the object as a DOM node.

Modified: GenericSetup/trunk/ZCatalog/configure.zcml
===================================================================
--- GenericSetup/trunk/ZCatalog/configure.zcml	2006-11-20 09:51:45 UTC (rev 71198)
+++ GenericSetup/trunk/ZCatalog/configure.zcml	2006-11-20 11:03:29 UTC (rev 71199)
@@ -1,12 +1,6 @@
 <configure
-    xmlns="http://namespaces.zope.org/zope"
-    >
+    xmlns="http://namespaces.zope.org/zope">
 
-  <adapter
-      factory=".exportimport.ZCatalogXMLAdapter"
-      provides="Products.GenericSetup.interfaces.IBody"
-      for="Products.ZCatalog.interfaces.IZCatalog
-           Products.GenericSetup.interfaces.ISetupEnviron"
-      />
+  <adapter factory=".exportimport.ZCatalogXMLAdapter"/>
 
 </configure>

Modified: GenericSetup/trunk/ZCatalog/exportimport.py
===================================================================
--- GenericSetup/trunk/ZCatalog/exportimport.py	2006-11-20 09:51:45 UTC (rev 71198)
+++ GenericSetup/trunk/ZCatalog/exportimport.py	2006-11-20 11:03:29 UTC (rev 71199)
@@ -15,9 +15,11 @@
 $Id$
 """
 
+from zope.component import adapts
 from zope.component import queryMultiAdapter
 
 from Products.GenericSetup.interfaces import INode
+from Products.GenericSetup.interfaces import ISetupEnviron
 from Products.GenericSetup.utils import ObjectManagerHelpers
 from Products.GenericSetup.utils import PropertyManagerHelpers
 from Products.GenericSetup.utils import XMLAdapterBase
@@ -36,7 +38,7 @@
     """XML im- and exporter for ZCatalog.
     """
 
-    __used_for__ = IZCatalog
+    adapts(IZCatalog, ISetupEnviron)
 
     _LOGGER_ID = 'catalog'
 

Modified: GenericSetup/trunk/components.py
===================================================================
--- GenericSetup/trunk/components.py	2006-11-20 09:51:45 UTC (rev 71198)
+++ GenericSetup/trunk/components.py	2006-11-20 11:03:29 UTC (rev 71199)
@@ -21,8 +21,6 @@
 from zope.component.interfaces import IComponentRegistry
 from zope.interface import implements
 
-from Acquisition import aq_base
-
 from interfaces import IBody
 from interfaces import ISetupEnviron
 from utils import XMLAdapterBase
@@ -31,11 +29,16 @@
 from utils import _getDottedName
 from utils import _resolveDottedName
 
+
 class ComponentRegistryXMLAdapter(XMLAdapterBase):
-    """In- and exporter for a local component registry.
+
+    """XML im- and exporter for a local component registry.
     """
+
     adapts(IComponentRegistry, ISetupEnviron)
-    implements(IBody)
+
+    _LOGGER_ID = 'componentregistry'
+
     name = 'componentregistry'
 
     def _exportNode(self):
@@ -235,6 +238,7 @@
         del namespace
         return name
 
+
 def dummyGetId():
     return ''
 
@@ -258,7 +262,7 @@
     """
     sm = getSiteManager(context.getSite())
     if sm is None or not IComponentRegistry.providedBy(sm):
-        logger = context.getLogger('sitemanager')
+        logger = context.getLogger('componentregistry')
         logger.info("Nothing to export.")
         return
     # XXX GenericSetup.utils.exportObjects expects the object to have a getId

Modified: GenericSetup/trunk/rolemap.py
===================================================================
--- GenericSetup/trunk/rolemap.py	2006-11-20 09:51:45 UTC (rev 71198)
+++ GenericSetup/trunk/rolemap.py	2006-11-20 11:03:29 UTC (rev 71199)
@@ -22,7 +22,8 @@
 
 from permissions import ManagePortal
 from utils import _xmldir
-from utils import ConfiguratorBase
+from utils import ExportConfiguratorBase
+from utils import ImportConfiguratorBase
 from utils import CONVERTER, DEFAULT, KEY
 
 
@@ -78,7 +79,7 @@
 
     if text is not None:
 
-        rc = RolemapConfigurator( site, encoding )
+        rc = RolemapImportConfigurator(site, encoding)
         rolemap_info = rc.parseXML( text )
 
         immediate_roles = list( getattr(site, '__ac_roles__', []) )
@@ -134,7 +135,7 @@
     site = context.getSite()
     logger = context.getLogger('rolemap')
 
-    rc = RolemapConfigurator( site ).__of__( site )
+    rc = RolemapExportConfigurator(site).__of__(site)
     text = rc.generateXML()
 
     context.writeDataFile( _FILENAME, text, 'text/xml' )
@@ -142,7 +143,8 @@
     logger.info('Role / permission map exported.')
 
 
-class RolemapConfigurator(ConfiguratorBase):
+class RolemapExportConfigurator(ExportConfiguratorBase):
+
     """ Synthesize XML description of sitewide role-permission settings.
     """
     security = ClassSecurityInfo()
@@ -196,6 +198,15 @@
 
         return PageTemplateFile('rmeExport.xml', _xmldir)
 
+InitializeClass(RolemapExportConfigurator)
+
+
+class RolemapImportConfigurator(ImportConfiguratorBase):
+
+    """ Synthesize XML description of sitewide role-permission settings.
+    """
+    security = ClassSecurityInfo()
+
     def _getImportMapping(self):
 
         return {
@@ -213,4 +224,4 @@
               'role':        {KEY: 'roles'},
               'acquire':     {CONVERTER: self._convertToBoolean} } }
 
-InitializeClass(RolemapConfigurator)
+InitializeClass(RolemapImportConfigurator)

Modified: GenericSetup/trunk/testing.py
===================================================================
--- GenericSetup/trunk/testing.py	2006-11-20 09:51:45 UTC (rev 71198)
+++ GenericSetup/trunk/testing.py	2006-11-20 11:03:29 UTC (rev 71199)
@@ -25,17 +25,13 @@
 from zope.component import getMultiAdapter
 from zope.interface import implements
 from zope.interface.verify import verifyClass
+from zope.testing.cleanup import cleanUp
 
 from interfaces import IBody
 from interfaces import INode
 from interfaces import ISetupEnviron
 
-try:
-    from zope.app.testing.placelesssetup import PlacelessSetup
-except ImportError:  # BBB, Zope3 < 3.1
-    from zope.app.tests.placelesssetup import PlacelessSetup
 
-
 class DummyLogger:
 
     def __init__(self, id, messages):
@@ -67,7 +63,7 @@
         return self._should_purge
 
 
-class _AdapterTestCaseBase(PlacelessSetup, unittest.TestCase):
+class _AdapterTestCaseBase(unittest.TestCase):
 
     def _populate(self, obj):
         pass
@@ -76,11 +72,13 @@
         pass
 
     def setUp(self):
-        PlacelessSetup.setUp(self)
         zcml.load_config('meta.zcml', Products.Five)
         zcml.load_config('permissions.zcml', Products.Five)
 
+    def tearDown(self):
+        cleanUp()
 
+
 class BodyAdapterTestCase(_AdapterTestCaseBase):
 
     def test_z3interfaces(self):
@@ -112,6 +110,7 @@
         self._verifyImport(self._obj)
         self.assertEqual(adapted.body, self._BODY)
 
+
 class NodeAdapterTestCase(_AdapterTestCaseBase):
 
     def test_z3interfaces(self):

Modified: GenericSetup/trunk/tests/common.py
===================================================================
--- GenericSetup/trunk/tests/common.py	2006-11-20 09:51:45 UTC (rev 71198)
+++ GenericSetup/trunk/tests/common.py	2006-11-20 11:03:29 UTC (rev 71199)
@@ -51,28 +51,22 @@
 
     def setUp(self):
         import Products
+        import zope.traversing
         from AccessControl.SecurityManagement import newSecurityManager
+
         ZopeTestCase.setUp(self)
-        try:
-            import zope.traversing
-            zcml.load_config('meta.zcml', Products.Five)
-            zcml.load_config('traversing.zcml', Products.Five)
-        except ImportError:
-            # BBB: for Zope 2.9
-            pass
+        zcml.load_config('meta.zcml', Products.Five)
+        zcml.load_config('traversing.zcml', Products.Five)
         self.root = self.app
         newSecurityManager(None, OmnipotentUser().__of__(self.app.acl_users))
 
     def tearDown(self):
         from AccessControl.SecurityManagement import noSecurityManager
+        from zope.testing.cleanup import cleanUp
+
         noSecurityManager()
         ZopeTestCase.tearDown(self)
-        try:
-            from zope.testing.cleanup import cleanUp
-            cleanUp()
-        except ImportError:
-            # BBB: for Zope 2.8
-            pass
+        cleanUp()
 
 
 class DOMComparator:

Modified: GenericSetup/trunk/tests/faux_objects.py
===================================================================
--- GenericSetup/trunk/tests/faux_objects.py	2006-11-20 09:51:45 UTC (rev 71198)
+++ GenericSetup/trunk/tests/faux_objects.py	2006-11-20 11:03:29 UTC (rev 71199)
@@ -2,25 +2,17 @@
 
 $Id$
 """
-from OFS.Folder import Folder
+
 from OFS.PropertyManager import PropertyManager
 from OFS.SimpleItem import SimpleItem
 from zope.interface import implements
 
-try:
-    from OFS.interfaces import IObjectManager
-    from OFS.interfaces import ISimpleItem
-    from OFS.interfaces import IPropertyManager
-except ImportError: # BBB
-    from Products.Five.interfaces import IObjectManager
-    from Products.Five.interfaces import ISimpleItem
-    from Products.Five.interfaces import IPropertyManager
 
 class TestSimpleItem(SimpleItem):
-    implements(ISimpleItem)
+    pass
 
 class TestSimpleItemWithProperties(SimpleItem, PropertyManager):
-    implements(ISimpleItem, IPropertyManager)
+    pass
 
 KNOWN_CSV = """\
 one,two,three

Modified: GenericSetup/trunk/tests/test_components.py
===================================================================
--- GenericSetup/trunk/tests/test_components.py	2006-11-20 09:51:45 UTC (rev 71198)
+++ GenericSetup/trunk/tests/test_components.py	2006-11-20 11:03:29 UTC (rev 71199)
@@ -19,10 +19,7 @@
 from Testing.ZopeTestCase import ZopeTestCase
 
 from AccessControl import ClassSecurityInfo
-from Acquisition import aq_base
-from Acquisition import aq_get
 from Globals import InitializeClass
-from OFS.Folder import Folder
 from OFS.SimpleItem import SimpleItem
 
 from Products.Five import zcml
@@ -113,6 +110,7 @@
 </componentregistry>
 """
 
+
 class ComponentRegistryXMLAdapterTests(ZopeTestCase, BodyAdapterTestCase):
 
     def _getTargetClass(self):
@@ -186,7 +184,12 @@
     def beforeTearDown(self):
         clearSite()
 
+
 def test_suite():
+    # reimport to make sure tests are run from Products
+    from Products.GenericSetup.tests.test_components \
+            import ComponentRegistryXMLAdapterTests
+
     return unittest.TestSuite((
         unittest.makeSuite(ComponentRegistryXMLAdapterTests),
         ))

Modified: GenericSetup/trunk/tests/test_content.py
===================================================================
--- GenericSetup/trunk/tests/test_content.py	2006-11-20 09:51:45 UTC (rev 71198)
+++ GenericSetup/trunk/tests/test_content.py	2006-11-20 11:03:29 UTC (rev 71199)
@@ -22,23 +22,18 @@
 from ConfigParser import ConfigParser
 from StringIO import StringIO
 
-try:
-    from OFS.interfaces import IObjectManager
-    from OFS.interfaces import ISimpleItem
-    from OFS.interfaces import IPropertyManager
-except ImportError: # BBB
-    from Products.Five.interfaces import IObjectManager
-    from Products.Five.interfaces import ISimpleItem
-    from Products.Five.interfaces import IPropertyManager
-
-from Products.GenericSetup.testing import PlacelessSetup
+from OFS.interfaces import IObjectManager
+from OFS.interfaces import ISimpleItem
+from OFS.interfaces import IPropertyManager
 from Products.GenericSetup.tests.common import DummyExportContext
 from Products.GenericSetup.tests.common import DummyImportContext
+from zope.testing.cleanup import cleanUp
 
 from conformance import ConformsToIINIAware
 from conformance import ConformsToIFilesystemExporter
 from conformance import ConformsToIFilesystemImporter
 
+
 class SimpleINIAwareTests(unittest.TestCase, ConformsToIINIAware):
 
     def _getTargetClass(self):
@@ -134,10 +129,12 @@
         self.assertEqual(context.float_prop, 2.818)
         self.assertEqual(context.date_prop, DateTime(DATESTR2))
 
-class FolderishExporterImporterTests(PlacelessSetup,
-                                     unittest.TestCase,
-                                    ):
 
+class FolderishExporterImporterTests(unittest.TestCase):
+
+    def tearDown(self):
+        cleanUp()
+
     def _getExporter(self):
         from Products.GenericSetup.content import exportSiteStructure
         return exportSiteStructure
@@ -152,10 +149,7 @@
 
     def _setUpAdapters(self):
         from OFS.Folder import Folder
-        try:
-            from zope.app.testing import ztapi
-        except ImportError:  # BBB, Zope3 < 3.1
-            from zope.app.tests import ztapi
+        from zope.app.testing import ztapi
         #from OFS.Image import File
 
         from Products.GenericSetup.interfaces import IFilesystemExporter
@@ -287,7 +281,7 @@
 
         site = _makeFolder('site')
         site.title = 'AAA'
-        site._setProperty('description', 'BBB')
+        site._setProperty('description', 'CCC')
         item = _makeItem('aside')
         dotted = _getDottedName(item.__class__)
         for id in ITEM_IDS:
@@ -317,7 +311,7 @@
         defaults = parser.defaults()
         self.assertEqual(len(defaults), 2)
         self.assertEqual(defaults['title'], 'AAA')
-        self.assertEqual(defaults['description'], 'BBB')
+        self.assertEqual(defaults['description'], 'CCC')
 
     def test_export_site_with_exportable_simple_items(self):
         from Products.GenericSetup.utils import _getDottedName
@@ -326,7 +320,7 @@
 
         site = _makeFolder('site')
         site.title = 'AAA'
-        site._setProperty('description', 'BBB')
+        site._setProperty('description', 'CCC')
         aware = _makeINIAware('aside')
         dotted = _getDottedName(aware.__class__)
         for id in ITEM_IDS:
@@ -363,7 +357,7 @@
         defaults = parser.defaults()
         self.assertEqual(len(defaults), 2)
         self.assertEqual(defaults['title'], 'AAA')
-        self.assertEqual(defaults['description'], 'BBB')
+        self.assertEqual(defaults['description'], 'CCC')
 
     def test_export_site_with_subfolders(self):
         from Products.GenericSetup.utils import _getDottedName
@@ -372,7 +366,7 @@
 
         site = _makeFolder('site')
         site.title = 'AAA'
-        site._setProperty('description', 'BBB')
+        site._setProperty('description', 'CCC')
         aside = _makeFolder('aside')
         dotted = _getDottedName(aside.__class__)
         for id in FOLDER_IDS:
@@ -424,7 +418,7 @@
         defaults = parser.defaults()
         self.assertEqual(len(defaults), 2)
         self.assertEqual(defaults['title'], 'AAA')
-        self.assertEqual(defaults['description'], 'BBB')
+        self.assertEqual(defaults['description'], 'CCC')
 
     def test_export_site_with_csvaware(self):
         from Products.GenericSetup.utils import _getDottedName

Modified: GenericSetup/trunk/tests/test_rolemap.py
===================================================================
--- GenericSetup/trunk/tests/test_rolemap.py	2006-11-20 09:51:45 UTC (rev 71198)
+++ GenericSetup/trunk/tests/test_rolemap.py	2006-11-20 11:03:29 UTC (rev 71199)
@@ -25,12 +25,12 @@
 from common import DummyImportContext
 
 
-class RolemapConfiguratorTests( BaseRegistryTests ):
+class RolemapExportConfiguratorTests(BaseRegistryTests):
 
     def _getTargetClass( self ):
 
-        from Products.GenericSetup.rolemap import RolemapConfigurator
-        return RolemapConfigurator
+        from Products.GenericSetup.rolemap import RolemapExportConfigurator
+        return RolemapExportConfigurator
 
     def test_listRoles_normal( self ):
 
@@ -166,6 +166,14 @@
 
         self._compareDOM( configurator.generateXML(), _UNACQUIRED_EXPORT )
 
+
+class RolemapImportConfiguratorTests(BaseRegistryTests):
+
+    def _getTargetClass( self ):
+
+        from Products.GenericSetup.rolemap import RolemapImportConfigurator
+        return RolemapImportConfigurator
+
     def test_parseXML_empty( self ):
 
         self.root.site = Folder( id='site' )
@@ -774,9 +782,10 @@
 
 def test_suite():
     return unittest.TestSuite((
-        unittest.makeSuite( RolemapConfiguratorTests ),
-        unittest.makeSuite( Test_exportRolemap ),
-        unittest.makeSuite( Test_importRolemap ),
+        unittest.makeSuite(RolemapExportConfiguratorTests),
+        unittest.makeSuite(RolemapImportConfiguratorTests),
+        unittest.makeSuite(Test_exportRolemap),
+        unittest.makeSuite(Test_importRolemap),
         ))
 
 if __name__ == '__main__':

Modified: GenericSetup/trunk/tests/test_zcml.py
===================================================================
--- GenericSetup/trunk/tests/test_zcml.py	2006-11-20 09:51:45 UTC (rev 71198)
+++ GenericSetup/trunk/tests/test_zcml.py	2006-11-20 11:03:29 UTC (rev 71199)
@@ -65,9 +65,8 @@
 
     Clean up and make sure the cleanup works::
 
-      >>> # BBB: in Zope 2.8 we can't import cleanUp
-      ... from zope.testing.cleanup import CleanUp
-      >>> CleanUp().cleanUp()
+      >>> from zope.testing.cleanup import cleanUp
+      >>> cleanUp()
       >>> profile_id in _profile_registry._profile_ids
       False
       >>> profile_id in _profile_registry._profile_info

Modified: GenericSetup/trunk/utils.py
===================================================================
--- GenericSetup/trunk/utils.py	2006-11-20 09:51:45 UTC (rev 71198)
+++ GenericSetup/trunk/utils.py	2006-11-20 11:03:29 UTC (rev 71199)
@@ -17,6 +17,7 @@
 
 import os
 import sys
+from cgi import escape
 from inspect import getdoc
 from xml.dom.minidom import _nssplit
 from xml.dom.minidom import Document
@@ -31,12 +32,7 @@
 from Acquisition import Implicit
 from Globals import InitializeClass
 from Globals import package_home
-try:
-    from OFS.interfaces import IOrderedContainer
-except:
-    #BBB: for Zope 2.8
-    from Products.Five.bbb.OFS_interfaces import IOrderedContainer
-from cgi import escape
+from OFS.interfaces import IOrderedContainer
 from zope.component import queryMultiAdapter
 from zope.interface import implements
 from zope.interface import implementsOnly
@@ -289,20 +285,6 @@
 InitializeClass(ExportConfiguratorBase)
 
 
-# BBB: old class mixing the two, will be removed in CMF 2.1
-class ConfiguratorBase(ImportConfiguratorBase, ExportConfiguratorBase):
-    """ Synthesize XML description.
-    """
-    security = ClassSecurityInfo()
-    security.setDefaultAccess('allow')
-
-    def __init__(self, site, encoding=None):
-        ImportConfiguratorBase.__init__(self, site, encoding)
-        ExportConfiguratorBase.__init__(self, site, encoding)
-
-InitializeClass(ConfiguratorBase)
-
-
 class _LineWrapper:
 
     def __init__(self, writer, indent, addindent, newl, max):
@@ -746,9 +728,6 @@
             path = '%s%s' % (parent_path, importer.name)
         filename = '%s%s' % (path, importer.suffix)
         body = context.readDataFile(filename)
-        if body is None and filename == 'types.xml':
-            # BBB: for CMF 1.5 profiles
-            body = context.readDataFile('typestool.xml')
         if body is not None:
             importer.filename = filename # for error reporting
             importer.body = body



More information about the Checkins mailing list