[Checkins] SVN: Sandbox/darrylcousins/mars.template/src/mars/template/template.txt Working up tests

Darryl Cousins darryl at darrylcousins.net.nz
Tue Jul 17 07:24:32 EDT 2007


Log message for revision 78062:
  Working up tests

Changed:
  U   Sandbox/darrylcousins/mars.template/src/mars/template/template.txt

-=-
Modified: Sandbox/darrylcousins/mars.template/src/mars/template/template.txt
===================================================================
--- Sandbox/darrylcousins/mars.template/src/mars/template/template.txt	2007-07-17 11:13:33 UTC (rev 78061)
+++ Sandbox/darrylcousins/mars.template/src/mars/template/template.txt	2007-07-17 11:24:32 UTC (rev 78062)
@@ -30,12 +30,21 @@
   ...     zope.interface.implements(zope.interface.Interface)
   >>> content = Content()
 
+We need a fake module_info object to pass to the grokkers.
+
+  >>> from martian.interfaces import IModuleInfo
+  >>> class ModuleInfo(object):
+  ...     zope.interface.implements(IModuleInfo)
+  ...     path = ''
+  ...     package_dotted_name = ''
+  ...     def getAnnotation(self, name, default):
+  ...         return default
+
 Create a view for the tests
 ---------------------------
 
 For our view we will use a grok.View with custom render method which looks up
-a template from the registry. (We could have used a mars.view which would use
-less code).
+a template from the registry. (I would usually use a mars.view).
 
   >>> class ITemplateView(zope.interface.Interface):
   ...     pass
@@ -48,16 +57,6 @@
   ...             (self, self.request), IPageTemplate)
   ...         return template(self)
 
-We need a fake module info object to pass to the grokker.
-
-  >>> from martian.interfaces import IModuleInfo
-  >>> class ModuleInfo(object):
-  ...     zope.interface.implements(IModuleInfo)
-  ...     path = ''
-  ...     package_dotted_name = ''
-  ...     def getAnnotation(self, name, default):
-  ...         return default
-
 In the test we manually ``grok`` the factory, normally this happens when a
 module is ``grokked`` on start up.
 
@@ -69,7 +68,7 @@
 Templates
 ---------
 
-This package offers primarily two template factories to mirror the z3c.template
+This package offers two template factories to mirror the z3c.template
 registrations, one registered as zope.pagetemplate.interfaces.IPageTemplate and
 the second as z3c.template.interfaces.ILayoutTemplate
 
@@ -81,6 +80,9 @@
     could be usefull if your view implementation needs to separate HTMl in
     more then one template. Now let's take a look how we an use this templates.
 
+Using mars.template we can also register different types of template using the
+``grok.provides`` directive to register the template to a different interface.
+
 IPageTemplate Template
 ----------------------
 
@@ -121,7 +123,7 @@
 First we need to register a new view class calling a layout template. Note,
 that this view uses the __call__ method for invoke a layout template:
 
-In this case we'll use a vanilla Zope3 page.
+In this case we'll use a ``vanilla`` Zope3 page.
 
   >>> from zope.publisher.browser import BrowserPage
   >>> from z3c.template.interfaces import ILayoutTemplate



More information about the Checkins mailing list