Author: jmorliaguet
Date: Fri Apr 28 09:57:08 2006
New Revision: 2977

Modified:
   cpsskins/branches/paris-sprint-2006/tests/setup.py
   cpsskins/branches/paris-sprint-2006/thememanager.py
Log:

- use the new component API



Modified: cpsskins/branches/paris-sprint-2006/tests/setup.py
==============================================================================
--- cpsskins/branches/paris-sprint-2006/tests/setup.py  (original)
+++ cpsskins/branches/paris-sprint-2006/tests/setup.py  Fri Apr 28 09:57:08 2006
@@ -17,7 +17,8 @@
 """
 __docformat__ = "reStructuredText"
 
-from zope.app.testing import ztapi, setup
+from zope.app import zapi
+from zope.app.testing import setup
 from zope.traversing.interfaces import IPathAdapter
 from zope.lifecycleevent.interfaces import IObjectCreatedEvent
 from zope.lifecycleevent.interfaces import IObjectModifiedEvent
@@ -39,28 +40,29 @@
 from cpsskins.thememanager import IThemeManagementFolder
 
 def setUp(test):
-    ztapi.provideAdapter(IDisplay, IPathAdapter, Formattable, 'formattable')
-    ztapi.provideAdapter(IElement, IPathAdapter, Displayable, 'displayable')
-    ztapi.provideAdapter(IElement, IRelationTool, RelationTool)
-    ztapi.provideAdapter(IElement, IIdentifiable, 
elements.element.Identifiable)
-    ztapi.provideAdapter(IElement, ITypeable, elements.element.Typeable)
-    ztapi.provideAdapter(IElement, IRelatable, elements.element.Relatable)
-    ztapi.provideAdapter(IPerspective, IRelatable, perspective.Relatable)
+    gsm = zapi.getGlobalSiteManager()
+    gsm.registerAdapter(Formattable, (IDisplay,), IPathAdapter, 'formattable')
+    gsm.registerAdapter(Displayable, (IElement,), IPathAdapter, 'displayable')
+    gsm.registerAdapter(RelationTool, (IElement,), IRelationTool)
+    gsm.registerAdapter(elements.element.Identifiable, (IElement,), 
+                        IIdentifiable)
+    gsm.registerAdapter(elements.element.Typeable, (IElement,), ITypeable)
+    gsm.registerAdapter(elements.element.Relatable, (IElement,), IRelatable)
+    gsm.registerAdapter(perspective.Relatable, (IPerspective,), IRelatable)
 
-    ztapi.provideAdapter(None, IRelationStorage, RelationStorage)
-    ztapi.provideUtility(IRelationStorage, RelationStorage())
+    gsm.registerAdapter(RelationStorage, (None,), IRelationStorage)
+    gsm.registerUtility(RelationStorage(), IRelationStorage)
 
     setup.setUpSiteManagerLookup()
 
     # events
-    ztapi.subscribe([IElement, IObjectCreatedEvent], None,
-                    controllers.elementCreated)
-    ztapi.subscribe([IElement, IObjectAddedEvent], None,
-                    controllers.elementAdded)
-    ztapi.subscribe([IElement, IObjectRemovedEvent], None,
-                    controllers.elementRemoved)
-    ztapi.subscribe([IElement, IObjectModifiedEvent], None,
-                    controllers.elementModified)
+    gsm.registerHandler(controllers.elementCreated,
+                        [IElement, IObjectCreatedEvent])
+    gsm.registerHandler(controllers.elementAdded, [IElement, 
IObjectAddedEvent])
+    gsm.registerHandler(controllers.elementRemoved,
+                        [IElement, IObjectRemovedEvent])
+    gsm.registerHandler(controllers.elementModified,
+                        [IElement, IObjectModifiedEvent])
 
 def makeSite(root):
     return setup.createSiteManager(root, True)

Modified: cpsskins/branches/paris-sprint-2006/thememanager.py
==============================================================================
--- cpsskins/branches/paris-sprint-2006/thememanager.py (original)
+++ cpsskins/branches/paris-sprint-2006/thememanager.py Fri Apr 28 09:57:08 2006
@@ -144,11 +144,11 @@
     >>> verifyClass(IThemeManagementFolder, ThemeManagementFolder)
     True
 
-    >>> from zope.app.testing import ztapi
     >>> from cpsskins.thememanager import ThemeManagementFolder
-    >>> thememanager = ThemeManagementFolder()
     >>> from cpsskins.thememanager import IThemeManagementFolder
-    >>> ztapi.provideUtility(IThemeManagementFolder, thememanager, 
name=u'themes')
+    >>> gsm = zapi.getGlobalSiteManager()
+    >>> gsm.registerUtility(ThemeManagementFolder(), IThemeManagementFolder,
+    ...                     name=u'themes')
     """
 
     implements(IThemeManagementFolder, IThemeContainer)
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to