[Zope3-checkins] SVN: Zope3/branches/roger-contentprovider/src/zope/contentprovider/ Fix adapter lookup

Roger Ineichen roger at projekt01.ch
Thu Oct 6 16:08:55 EDT 2005


Log message for revision 38825:
  Fix adapter lookup

Changed:
  U   Zope3/branches/roger-contentprovider/src/zope/contentprovider/SETUP.cfg
  U   Zope3/branches/roger-contentprovider/src/zope/contentprovider/tales.py

-=-
Modified: Zope3/branches/roger-contentprovider/src/zope/contentprovider/SETUP.cfg
===================================================================
--- Zope3/branches/roger-contentprovider/src/zope/contentprovider/SETUP.cfg	2005-10-06 20:05:00 UTC (rev 38824)
+++ Zope3/branches/roger-contentprovider/src/zope/contentprovider/SETUP.cfg	2005-10-06 20:08:54 UTC (rev 38825)
@@ -1,5 +1,5 @@
 # Tell zpkg how to install the ZCML slugs.
 
 <data-files zopeskel/etc/package-includes>
-  zope.app.viewlet-*.zcml
+  zope.contentprovider-*.zcml
 </data-files>

Modified: Zope3/branches/roger-contentprovider/src/zope/contentprovider/tales.py
===================================================================
--- Zope3/branches/roger-contentprovider/src/zope/contentprovider/tales.py	2005-10-06 20:05:00 UTC (rev 38824)
+++ Zope3/branches/roger-contentprovider/src/zope/contentprovider/tales.py	2005-10-06 20:08:54 UTC (rev 38825)
@@ -18,8 +18,10 @@
 __docformat__ = 'restructuredtext'
 import zope.interface
 import zope.component
+from zope.component.interfaces import ISiteManager
 from zope.tales import expressions
 
+from zope.interface.declarations import providedBy
 from zope.contentprovider import interfaces, manager
 
 
@@ -56,13 +58,21 @@
         # get the region from the expression
         region = getRegion(self._s)
 
-        # Find the viewlets
-        cpManager = zope.component.queryMultiAdapter(
-            (context, request, view), interfaces.IContentProviderManager)
+        cpManager = None
+        res = []
+        iface = interfaces.IContentProviderManager
+        objs = (context, request, view)
+        lookup = ISiteManager(context).adapters.lookup
+        cpManagerClass = lookup(map(providedBy, objs)+[region], iface, name='')
+        if cpManagerClass is not None:
+            cpManager = cpManager(context, request, view, region)
+            
+
         if cpManager is None:
             cpManager = manager.DefaultContentProviderManager(
                 context, request, view, region)
 
+
         providers = cpManager.values(region)
         #providers = cpManager.values()
 



More information about the Zope3-Checkins mailing list