[Zope3-checkins]
SVN: Zope3/branches/roger-contentprovider/src/zope/contentprovider/
finished clean-up contentprovider package after separation
from viewlet
Helmut Merz
helmutm at cy55.de
Fri Oct 7 05:31:24 EDT 2005
Log message for revision 38850:
finished clean-up contentprovider package after separation from viewlet
Changed:
U Zope3/branches/roger-contentprovider/src/zope/contentprovider/README.txt
U Zope3/branches/roger-contentprovider/src/zope/contentprovider/interfaces.py
U Zope3/branches/roger-contentprovider/src/zope/contentprovider/tales.py
-=-
Modified: Zope3/branches/roger-contentprovider/src/zope/contentprovider/README.txt
===================================================================
--- Zope3/branches/roger-contentprovider/src/zope/contentprovider/README.txt 2005-10-07 09:21:12 UTC (rev 38849)
+++ Zope3/branches/roger-contentprovider/src/zope/contentprovider/README.txt 2005-10-07 09:31:24 UTC (rev 38850)
@@ -157,7 +157,7 @@
>>> class InfoViewlet(object):
... zope.interface.implements(interfaces.IContentProvider)
- ... def __init__(self, *args):
+ ... def __init__(self, context, request,view):
... pass
... title = 'Info Viewlet'
... weight = 3
@@ -196,8 +196,8 @@
Changing the Weight
~~~~~~~~~~~~~~~~~~~
-Let's ensure that the weight really affects the order of the viewlets. If we
-change the weights around,
+Let's ensure that the weight really affects the order of the content providers.
+If we change the weights around,
>>> InfoViewlet.weight = 0
>>> Viewlet.weight = 1
@@ -343,7 +343,7 @@
>>> from zope.app.publisher.browser import BrowserView
- >>> class NameColumnViewlet(BrowserView):
+ >>> class NameColumnViewlet(object):
... zope.interface.implements(IObjectInfoColumn)
... weight = 0
...
Modified: Zope3/branches/roger-contentprovider/src/zope/contentprovider/interfaces.py
===================================================================
--- Zope3/branches/roger-contentprovider/src/zope/contentprovider/interfaces.py 2005-10-07 09:21:12 UTC (rev 38849)
+++ Zope3/branches/roger-contentprovider/src/zope/contentprovider/interfaces.py 2005-10-07 09:31:24 UTC (rev 38850)
@@ -48,15 +48,6 @@
the corresponding region interface.
"""
- context = zope.interface.Attribute(
- 'The context the content provider is used for.')
-
- request = zope.interface.Attribute(
- 'The request the content provider is used in.')
-
- view = zope.interface.Attribute(
- 'The view the content provider is used in.')
-
weight = zope.schema.Int(
title=_(u'weight'),
description=_(u"""
Modified: Zope3/branches/roger-contentprovider/src/zope/contentprovider/tales.py
===================================================================
--- Zope3/branches/roger-contentprovider/src/zope/contentprovider/tales.py 2005-10-07 09:21:12 UTC (rev 38849)
+++ Zope3/branches/roger-contentprovider/src/zope/contentprovider/tales.py 2005-10-07 09:31:24 UTC (rev 38850)
@@ -62,6 +62,7 @@
res = []
iface = interfaces.IContentProviderManager
objs = (context, request, view)
+ # we have to use the lookup method because region is an interface!
lookup = ISiteManager(context).adapters.lookup
cpManagerClass = lookup(map(providedBy, objs)+[region], iface, name='')
if cpManagerClass is not None:
@@ -107,9 +108,17 @@
# get the region from the expression
region = getRegion(self._iface)
- # Find the viewlets
- cpManager = zope.component.queryMultiAdapter(
- (context, request, view), interfaces.IContentProviderManager)
+ # Find the content provider
+ cpManager = None
+ res = []
+ iface = interfaces.IContentProviderManager
+ objs = (context, request, view)
+ # we have to use the lookup method because region is an interface!
+ lookup = ISiteManager(context).adapters.lookup
+ cpManagerClass = lookup(map(providedBy, objs)+[region], iface, name='')
+ if cpManagerClass is not None:
+ cpManager = cpManagerClass(context, request, view, region)
+
if cpManager is None:
cpManager = manager.DefaultContentProviderManager(
context, request, view, region)
More information about the Zope3-Checkins
mailing list