[Zope3-checkins] SVN: Zope3/branches/roger-contentprovider/src/zope/contentprovider/ first steps towards making the tests run again

Helmut Merz helmutm at cy55.de
Thu Oct 6 13:58:30 EDT 2005


Log message for revision 38815:
  first steps towards making the tests run again

Changed:
  U   Zope3/branches/roger-contentprovider/src/zope/contentprovider/README.txt
  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-06 17:39:03 UTC (rev 38814)
+++ Zope3/branches/roger-contentprovider/src/zope/contentprovider/README.txt	2005-10-06 17:58:30 UTC (rev 38815)
@@ -52,14 +52,17 @@
 filling; we will demonstrate a more advanced example later, where the purpose
 of this requirement becomes clear.
 
-  >>> class TestViewlet(object):
+  >>> class Viewlet(object):
+  ...     def __init__(self, *args): pass
   ...     title = 'Demo Viewlet'
   ...     weight = 1
   ...     def __call__(self, *args, **kw):
   ...         return 'viewlet content'
 
-  >>> Viewlet = TestViewlet()
-
+  # Generate a viewlet checker
+  >>> from zope.security.checker import NamesChecker, defineChecker
+  >>> viewletChecker = NamesChecker(('__call__', 'weight', 'title',))
+  >>> defineChecker(Viewlet, viewletChecker)
   
   # Register the viewlet with component architecture
   >>> from zope.publisher.interfaces.browser import IDefaultBrowserLayer
@@ -135,11 +138,7 @@
       <h1>My Web Page</h1>
       <div class="left-column">
         <div class="column-item">
-  <BLANKLINE>
-          <div class="box">
-            Viewlet Title
-          </div>
-  <BLANKLINE>
+          viewlet content
         </div>
       </div>
       <div class="main">
@@ -323,7 +322,7 @@
   ...     <h1>Contents</h1>
   ...     <table>
   ...       <tr tal:repeat="item view/objectInfo">
-  ...         <td tal:repeat="column viewlets:webpage.ObjectInfoColumn"
+  ...         <td tal:repeat="column providers:webpage.ObjectInfoColumn"
   ...             tal:content="structure column" />
   ...       </tr>
   ...     </table>

Modified: Zope3/branches/roger-contentprovider/src/zope/contentprovider/tales.py
===================================================================
--- Zope3/branches/roger-contentprovider/src/zope/contentprovider/tales.py	2005-10-06 17:39:03 UTC (rev 38814)
+++ Zope3/branches/roger-contentprovider/src/zope/contentprovider/tales.py	2005-10-06 17:58:30 UTC (rev 38815)
@@ -57,20 +57,20 @@
         region = getRegion(self._s)
 
         # Find the viewlets
-        viewletManager = zope.component.queryMultiAdapter(
-            (context, request, view), interfaces.IViewletManager)
-        if viewletManager is None:
-            viewletManager = manager.DefaultViewletManager(
+        cpManager = zope.component.queryMultiAdapter(
+            (context, request, view), interfaces.IContentProviderManager)
+        if cpManager is None:
+            cpManager = manager.DefaultContentProviderManager(
                 context, request, view)
 
-        viewlets = viewletManager.getViewlets(region)
+        providers = cpManager.values(region)
 
         # Insert the data gotten from the context
         data = getRegionFieldData(region, econtext)
-        for viewlet in viewlets:
-            viewlet.__dict__.update(data)
+        for provider in providers:
+            provider.__dict__.update(data)
 
-        return viewlets
+        return providers
 
 
 class TALESProviderExpression(expressions.StringExpr):



More information about the Zope3-Checkins mailing list