Author: jmorliaguet
Date: Wed Oct 12 05:16:25 2005
New Revision: 28163

Modified:
   z3lab/cpsskins/branches/jmo-perspectives/browser/authoring/__init__.py
   z3lab/cpsskins/branches/jmo-perspectives/browser/elements/__init__.py
   z3lab/cpsskins/branches/jmo-perspectives/browser/negociation/__init__.py
   z3lab/cpsskins/branches/jmo-perspectives/browser/renderers/__init__.py
   z3lab/cpsskins/branches/jmo-perspectives/configuration/engines/__init__.py
   
z3lab/cpsskins/branches/jmo-perspectives/configuration/engines/metaconfigure.py
Log:

- using 'provideInterface' to handle engine names / interfaces relations
  (cf. ++engine++name )

- removed unused imports



Modified: z3lab/cpsskins/branches/jmo-perspectives/browser/authoring/__init__.py
==============================================================================
--- z3lab/cpsskins/branches/jmo-perspectives/browser/authoring/__init__.py      
(original)
+++ z3lab/cpsskins/branches/jmo-perspectives/browser/authoring/__init__.py      
Wed Oct 12 05:16:25 2005
@@ -19,7 +19,6 @@
 
 from zope.app import zapi
 from zope.app.container.browser.contents import Contents
-from zope.app.copypastemove.interfaces import IObjectCopier
 from zope.app.location.traversing import LocationPhysicallyLocatable
 from zope.app.publisher.browser import BrowserView
 from zope.app.session.interfaces import ISession

Modified: z3lab/cpsskins/branches/jmo-perspectives/browser/elements/__init__.py
==============================================================================
--- z3lab/cpsskins/branches/jmo-perspectives/browser/elements/__init__.py       
(original)
+++ z3lab/cpsskins/branches/jmo-perspectives/browser/elements/__init__.py       
Wed Oct 12 05:16:25 2005
@@ -21,7 +21,7 @@
 from zope.app.container.browser.adding import Adding
 from zope.app.copypastemove.interfaces import IObjectCopier, IObjectMover
 from zope.app.traversing.api import getParent
-from zope.app.zapi import queryMultiAdapter, getMultiAdapter
+from zope.app.zapi import getMultiAdapter
 from zope.interface import implements
 
 from interfaces import INodeAdding, INodeRemoving, INodeOrdering, INodeMoving

Modified: 
z3lab/cpsskins/branches/jmo-perspectives/browser/negociation/__init__.py
==============================================================================
--- z3lab/cpsskins/branches/jmo-perspectives/browser/negociation/__init__.py    
(original)
+++ z3lab/cpsskins/branches/jmo-perspectives/browser/negociation/__init__.py    
Wed Oct 12 05:16:25 2005
@@ -20,11 +20,10 @@
 from zope.app import zapi
 from zope.app.publisher.browser import BrowserView
 from zope.app.session.interfaces import ISession
-from zope.component import getUtility
+from zope.component import getUtilitiesFor
 from zope.interface import directlyProvidedBy
 
 from cpsskins.configuration.engines.interfaces import IEngine
-from cpsskins.configuration.interfaces import IRegistry
 from cpsskins.browser.renderers.interfaces import IRenderer
 from cpsskins.thememanager import getThemeManager
 
@@ -58,9 +57,10 @@
         return perspective
 
     def getEffectiveEngine(self):
-        engine_registry = getUtility(IRegistry, 'engines')
         for iface in directlyProvidedBy(self.request):
             if not iface.extends(IEngine):
                 continue
-            return engine_registry.get(iface, 'default')
+            for name, engine in list(getUtilitiesFor(IEngine)):
+                if engine == iface:
+                    return name
         return 'default'

Modified: z3lab/cpsskins/branches/jmo-perspectives/browser/renderers/__init__.py
==============================================================================
--- z3lab/cpsskins/branches/jmo-perspectives/browser/renderers/__init__.py      
(original)
+++ z3lab/cpsskins/branches/jmo-perspectives/browser/renderers/__init__.py      
Wed Oct 12 05:16:25 2005
@@ -21,13 +21,11 @@
 from zope.app.zapi import getMultiAdapter, queryMultiAdapter
 from zope.component import adapts, getUtility
 from zope.interface import implements
-from zope.interface.declarations import directlyProvidedBy
 from zope.publisher.interfaces import IRequest
 
 from cpsskins.browser.negociation.interfaces import INegociation
 from cpsskins.browser.renderers.filters.interfaces import IFilter
 from cpsskins.configuration.interfaces import IRegistry
-from cpsskins.configuration.engines.interfaces import IEngine
 from cpsskins.elements.interfaces import IElement, ISlot, IDisplayable
 from cpsskins.relations.interfaces import IPredicate
 from cpsskins.storage.interfaces import IRelationStorage

Modified: 
z3lab/cpsskins/branches/jmo-perspectives/configuration/engines/__init__.py
==============================================================================
--- z3lab/cpsskins/branches/jmo-perspectives/configuration/engines/__init__.py  
(original)
+++ z3lab/cpsskins/branches/jmo-perspectives/configuration/engines/__init__.py  
Wed Oct 12 05:16:25 2005
@@ -17,35 +17,21 @@
 """
 __docformat__ = "reStructuredText"
 
-"""Rendering engine configuration
+"""Rendering engine traverser /++engine++name
 """
 
 from zope.app.traversing.namespace import view
-from zope.component import provideUtility, getUtility
-from zope.interface import implements
+from zope.component import queryUtility
 from zope.interface import alsoProvides
 
-from cpsskins.configuration import ConfigurationRegistry
-from cpsskins.configuration.interfaces import IRegistry
 from interfaces import IEngine
 
-
-class EngineRegistry(ConfigurationRegistry):
-    """An engine registry stores information about rendering engines.
-    """
-    implements(IRegistry)
-
-provideUtility(EngineRegistry(), IRegistry, 'engines')
-
 class engine(view):
 
     def traverse(self, name, ignored):
-        request = self.request
+        engine = queryUtility(IEngine, name, None)
 
-        engine_registry = getUtility(IRegistry, 'engines')
-        engine = engine_registry.get(name, [])
-
-        alsoProvides(request, engine)
+        if engine is not None:
+            alsoProvides(self.request, engine)
 
         return self.context
-

Modified: 
z3lab/cpsskins/branches/jmo-perspectives/configuration/engines/metaconfigure.py
==============================================================================
--- 
z3lab/cpsskins/branches/jmo-perspectives/configuration/engines/metaconfigure.py 
    (original)
+++ 
z3lab/cpsskins/branches/jmo-perspectives/configuration/engines/metaconfigure.py 
    Wed Oct 12 05:16:25 2005
@@ -17,12 +17,14 @@
 """
 __docformat__ = "reStructuredText"
 
-from zope.component import getUtility
+from zope.app.component.interface import provideInterface
 
-from cpsskins.configuration.interfaces import IRegistry
-
-engine_registry = getUtility(IRegistry, 'engines')
+from cpsskins.configuration.engines.interfaces import IEngine
 
 def engine(_context, name, interface):
-    engine_registry.register(name, interface)
-    engine_registry.register(interface, name)
+
+    _context.action(
+        discriminator = ('engine', name),
+        callable = provideInterface,
+        args = (name, interface, IEngine, _context.info)
+        )
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to