From 4e7436febec1f4dc10a5b32fcc4020bea751226d Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Fri, 9 Oct 2009 07:55:07 +0000 Subject: route -> static directive. --- docs/tutorials/bfgwiki2/basiclayout.rst | 11 ++++------- docs/tutorials/bfgwiki2/definingviews.rst | 11 +++++------ .../bfgwiki2/src/authorization/tutorial/configure.zcml | 5 ++--- docs/tutorials/bfgwiki2/src/authorization/tutorial/views.py | 3 --- .../bfgwiki2/src/basiclayout/tutorial/configure.zcml | 5 ++--- docs/tutorials/bfgwiki2/src/basiclayout/tutorial/views.py | 3 --- docs/tutorials/bfgwiki2/src/models/tutorial/configure.zcml | 5 ++--- docs/tutorials/bfgwiki2/src/models/tutorial/views.py | 3 --- docs/tutorials/bfgwiki2/src/views/tutorial/configure.zcml | 5 ++--- docs/tutorials/bfgwiki2/src/views/tutorial/views.py | 3 --- 10 files changed, 17 insertions(+), 37 deletions(-) (limited to 'docs') diff --git a/docs/tutorials/bfgwiki2/basiclayout.rst b/docs/tutorials/bfgwiki2/basiclayout.rst index ca72fd42a..9efee63a7 100644 --- a/docs/tutorials/bfgwiki2/basiclayout.rst +++ b/docs/tutorials/bfgwiki2/basiclayout.rst @@ -42,13 +42,10 @@ following: response. You will use mostly ```` statements in a :term:`URL dispatch` based application to map URLs to code. -#. *Lines 14-17*. Register a ```` that will match with a path - that starts with ``/static/``. This points at a bit of code - (``.views.static_view``) that will serve up static resources for - us, in this case, at ``http://localhost:6543/static/`` and below. - The ``*subpath`` token captures the remainder of the path and sets - the request :term:`subpath` to a derivation of the remainder of the - path, which is relied on by the view it mentions. With this view +#. *Lines 14-17*. Register a ```` directive that will match + any URL hat starts with ``/static/``. This will serve up static + resources for us, in this case, at + ``http://localhost:6543/static/`` and below. With this declaration, we're saying that any URL that starts with ``/static`` should go to the static view; any remainder of its path (e.g. the ``/foo`` in ``/static/foo``) will be used to compose a path to a diff --git a/docs/tutorials/bfgwiki2/definingviews.rst b/docs/tutorials/bfgwiki2/definingviews.rst index b89a2c7f7..6dbea104e 100644 --- a/docs/tutorials/bfgwiki2/definingviews.rst +++ b/docs/tutorials/bfgwiki2/definingviews.rst @@ -245,9 +245,10 @@ our package's ``templates/static`` directory: This CSS file will be accessed via e.g. ``http://localhost:6543/static/style.css`` by virtue of the -``static_view`` view we've defined in the ``views.py`` file. Any -number and type of static resources can be placed in this directory -(or subdirectories) and are just referred to by URL within templates. +```` directive we've defined in the ``configure.zcml`` file. +Any number and type of static resources can be placed in this +directory (or subdirectories) and are just referred to by URL within +templates. Mapping Views to URLs in ``configure.zcml`` =========================================== @@ -256,9 +257,7 @@ The ``configure.zcml`` file contains ``route`` declarations (and a lone ``view`` declaration) which serve to map URLs via :term:`url dispatch` to view functions. First, we’ll get rid of the existing ``route`` created by the template using the name ``home``. It’s only -an example and isn’t relevant to our application. We'll leave the -static ``view`` declaration as it is, since we are going to use it to -serve CSS. +an example and isn’t relevant to our application. We then need to add four ``route`` declarations to ``configure.zcml``. Note that the *ordering* of these declarations is very important. diff --git a/docs/tutorials/bfgwiki2/src/authorization/tutorial/configure.zcml b/docs/tutorials/bfgwiki2/src/authorization/tutorial/configure.zcml index 65b29019b..001959bb1 100644 --- a/docs/tutorials/bfgwiki2/src/authorization/tutorial/configure.zcml +++ b/docs/tutorials/bfgwiki2/src/authorization/tutorial/configure.zcml @@ -6,10 +6,9 @@ - - diff --git a/docs/tutorials/bfgwiki2/src/basiclayout/tutorial/views.py b/docs/tutorials/bfgwiki2/src/basiclayout/tutorial/views.py index f101b2742..a98712ad5 100644 --- a/docs/tutorials/bfgwiki2/src/basiclayout/tutorial/views.py +++ b/docs/tutorials/bfgwiki2/src/basiclayout/tutorial/views.py @@ -1,11 +1,8 @@ from repoze.bfg.chameleon_zpt import render_template_to_response -from repoze.bfg.view import static from tutorial.models import DBSession from tutorial.models import Model -static_view = static('templates/static') - def my_view(request): dbsession = DBSession() root = dbsession.query(Model).filter(Model.name==u'root').first() diff --git a/docs/tutorials/bfgwiki2/src/models/tutorial/configure.zcml b/docs/tutorials/bfgwiki2/src/models/tutorial/configure.zcml index f6139f85e..285184c38 100644 --- a/docs/tutorials/bfgwiki2/src/models/tutorial/configure.zcml +++ b/docs/tutorials/bfgwiki2/src/models/tutorial/configure.zcml @@ -11,10 +11,9 @@ view=".views.my_view" /> - diff --git a/docs/tutorials/bfgwiki2/src/models/tutorial/views.py b/docs/tutorials/bfgwiki2/src/models/tutorial/views.py index f101b2742..a98712ad5 100644 --- a/docs/tutorials/bfgwiki2/src/models/tutorial/views.py +++ b/docs/tutorials/bfgwiki2/src/models/tutorial/views.py @@ -1,11 +1,8 @@ from repoze.bfg.chameleon_zpt import render_template_to_response -from repoze.bfg.view import static from tutorial.models import DBSession from tutorial.models import Model -static_view = static('templates/static') - def my_view(request): dbsession = DBSession() root = dbsession.query(Model).filter(Model.name==u'root').first() diff --git a/docs/tutorials/bfgwiki2/src/views/tutorial/configure.zcml b/docs/tutorials/bfgwiki2/src/views/tutorial/configure.zcml index 3a7ff7fc8..1e5207ebc 100644 --- a/docs/tutorials/bfgwiki2/src/views/tutorial/configure.zcml +++ b/docs/tutorials/bfgwiki2/src/views/tutorial/configure.zcml @@ -6,10 +6,9 @@ -