From 820508eb8200692cc8b1510caa19903d2af79c5a Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sat, 10 Oct 2009 01:03:53 +0000 Subject: Convert bfgwiki to use renderers. --- docs/tutorials/bfgwiki/basiclayout.rst | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'docs/tutorials/bfgwiki/basiclayout.rst') diff --git a/docs/tutorials/bfgwiki/basiclayout.rst b/docs/tutorials/bfgwiki/basiclayout.rst index d57cd7134..5df7f2487 100644 --- a/docs/tutorials/bfgwiki/basiclayout.rst +++ b/docs/tutorials/bfgwiki/basiclayout.rst @@ -30,18 +30,28 @@ XML namespace. Our sample ZCML file looks like the following: #. *Line 4*. Boilerplate, the comment explains. -#. *Lines 6-9*. Register a ```` that is bound to a class. +#. *Lines 6-10*. Register a ```` that is ``for`` a class. ``.views.my_view`` is a *function* we write (generated by the ``bfg_zodb`` template) that is given a ``context`` and a - ``request`` and returns a response. + ``request`` and which returns a dictionary. The ``renderer`` tag + indicates that the ``templates/mytemplate.pt`` template should be + used to turn the dictionary returned by the view into a response. + ``templates/mytemplate.pt`` is a *relative* path: it names the + ``mytemplate.pt`` file which lives in the ``templates`` + subdirectory of the directory in which this ``configure.zcml`` + lives in. In this case, it means it lives in the ``tutorial`` + package's ``templates`` directory as ``mytemplate.pt`` Since this ```` doesn't have a ``name`` attribute, it is the "default" view for that class. -#. *Lines 11-15*. Register a ``static`` view which answers requests +#. *Lines 12-15*. Register a ``static`` view which answers requests which start with ``/static``. This is a view that will serve up static resources for us, in this case, at - ``http://localhost:6543/static/`` and below. + ``http://localhost:6543/static/`` and below. The ``path`` element + of this tag is a relative directory name, so it finds the resources + it should serve within the ``templates/static`` directory inside + the ``tutorial`` package. Content Models with ``models.py`` --------------------------------- -- cgit v1.2.3