From 203fe8b2a92c18151894f0656b7846cef8ec4e51 Mon Sep 17 00:00:00 2001 From: Patrick Canfield Date: Mon, 18 Mar 2013 12:00:43 -0700 Subject: Update basiclayout.rst, more deductive concept ordering, singular form of terms --- docs/tutorials/wiki2/basiclayout.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'docs/tutorials/wiki2') diff --git a/docs/tutorials/wiki2/basiclayout.rst b/docs/tutorials/wiki2/basiclayout.rst index eb2445864..109d368b8 100644 --- a/docs/tutorials/wiki2/basiclayout.rst +++ b/docs/tutorials/wiki2/basiclayout.rst @@ -132,11 +132,11 @@ Finally, ``main`` is finished configuring things, so it uses the View Declarations via ``views.py`` ---------------------------------- -Mapping a :term:`route` to code that will be executed when a match for -the route's pattern occurs is done by registering a :term:`view -configuration`. Our application uses the -:meth:`pyramid.view.view_config` decorator to map view callables to -each route, thereby mapping URL patterns to code. +Arguably, the main function of a web framework is mapping each URL +patterns, see :term:`route`, to code, see :term:`view callable`, that is +executed when the requested URL matches the corresponding :term:`route`. Our +application uses the :meth:`pyramid.view.view_config` decorator to perform +this mapping. Open ``tutorial/tutorial/views.py``. It should already contain the following: -- cgit v1.2.3 From b1611cf0d24e2947ebfb58071ff7c695a1d824cc Mon Sep 17 00:00:00 2001 From: Patrick Canfield Date: Mon, 18 Mar 2013 13:05:41 -0700 Subject: Update definingviews.rst explain matchdict more explicitly, concisely --- docs/tutorials/wiki2/basiclayout.rst | 9 ++++----- docs/tutorials/wiki2/definingviews.rst | 15 +++++++-------- 2 files changed, 11 insertions(+), 13 deletions(-) (limited to 'docs/tutorials/wiki2') diff --git a/docs/tutorials/wiki2/basiclayout.rst b/docs/tutorials/wiki2/basiclayout.rst index 109d368b8..6d6287126 100644 --- a/docs/tutorials/wiki2/basiclayout.rst +++ b/docs/tutorials/wiki2/basiclayout.rst @@ -228,11 +228,10 @@ To give a simple example of a model class, we define one named ``MyModel``: Our example model has an ``__init__`` method that takes two arguments (``name``, and ``value``). It stores these values as ``self.name`` and -``self.value`` -within the ``__init__`` function itself. The ``MyModel`` class also has a -``__tablename__`` attribute. This informs SQLAlchemy which table to use to -store the data representing instances of this class. +``self.value`` within the ``__init__`` function itself. The ``MyModel`` class +also has a ``__tablename__`` attribute. This informs SQLAlchemy which table +to use to store the data representing instances of this class. -That's about all there is to it to models, views, and initialization code in +That's about all there is to it with models, views, and initialization code in our stock application. diff --git a/docs/tutorials/wiki2/definingviews.rst b/docs/tutorials/wiki2/definingviews.rst index f2ac2f85f..72cba8d1e 100644 --- a/docs/tutorials/wiki2/definingviews.rst +++ b/docs/tutorials/wiki2/definingviews.rst @@ -6,14 +6,13 @@ A :term:`view callable` in a :app:`Pyramid` application is typically a simple Python function that accepts a single parameter named :term:`request`. A view callable is assumed to return a :term:`response` object. -The request object passed to every view that is called as the result of a -route match has an attribute named ``matchdict`` that contains the elements -placed into the URL by the ``pattern`` of a ``route`` statement. For -instance, if a call to :meth:`pyramid.config.Configurator.add_route` in -``__init__.py`` had the pattern ``{one}/{two}``, and the URL at -``http://example.com/foo/bar`` was invoked, matching this pattern, the -``matchdict`` dictionary attached to the request passed to the view would -have a ``'one'`` key with the value ``'foo'`` and a ``'two'`` key with the +The request object has an attribute named ``matchdict``. A ``matchdict`` maps +the placeholders in the matching URL ``pattern`` to the substrings of the +:term:`request` ed URL. For instance, if a call to +:meth:`pyramid.config.Configurator.add_route` in ``__init__.py`` had the pattern +``{one}/{two}``, and the URL at ``http://example.com/foo/bar`` was invoked, matching +this pattern, the ``matchdict`` dictionary attached to the request passed to the view +would have a ``'one'`` key with the value ``'foo'`` and a ``'two'`` key with the value ``'bar'``. -- cgit v1.2.3 From b4eeddf672987c8f03058f5bf0d4f7080007b0e2 Mon Sep 17 00:00:00 2001 From: Patrick Canfield Date: Mon, 18 Mar 2013 14:12:23 -0700 Subject: Update definingviews.rst to be more explicit, concise (?) A make the first sentence a litte more explicit, default to present tense, remove unnecessary details and use python instead of english when it's cleared to do so. --- docs/tutorials/wiki2/definingviews.rst | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'docs/tutorials/wiki2') diff --git a/docs/tutorials/wiki2/definingviews.rst b/docs/tutorials/wiki2/definingviews.rst index 72cba8d1e..9df72c926 100644 --- a/docs/tutorials/wiki2/definingviews.rst +++ b/docs/tutorials/wiki2/definingviews.rst @@ -6,14 +6,12 @@ A :term:`view callable` in a :app:`Pyramid` application is typically a simple Python function that accepts a single parameter named :term:`request`. A view callable is assumed to return a :term:`response` object. -The request object has an attribute named ``matchdict``. A ``matchdict`` maps -the placeholders in the matching URL ``pattern`` to the substrings of the -:term:`request` ed URL. For instance, if a call to -:meth:`pyramid.config.Configurator.add_route` in ``__init__.py`` had the pattern -``{one}/{two}``, and the URL at ``http://example.com/foo/bar`` was invoked, matching -this pattern, the ``matchdict`` dictionary attached to the request passed to the view -would have a ``'one'`` key with the value ``'foo'`` and a ``'two'`` key with the -value ``'bar'``. +The request object has a dictionary as an attribute named ``matchdict``. +A ``matchdict`` maps the placeholders in the matching URL ``pattern`` to the substrings +of the :term:`request` ed URL. For instance, if a call to +:meth:`pyramid.config.Configurator.add_route` has the pattern +``{one}/{two}``, and the URL at ``http://example.com/foo/bar`` is invoked, matching +this pattern, the ``matchdict`` attached to the request would look like: ``{'one':'foo', 'two':'bar'}`` Declaring Dependencies in Our ``setup.py`` File -- cgit v1.2.3 From e163c0931e17c3ad79dd0fa08cea924db1813558 Mon Sep 17 00:00:00 2001 From: Patrick Canfield Date: Mon, 18 Mar 2013 14:16:57 -0700 Subject: Update definingviews.rst to use active voice, reduce redundancy. --- docs/tutorials/wiki2/definingviews.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'docs/tutorials/wiki2') diff --git a/docs/tutorials/wiki2/definingviews.rst b/docs/tutorials/wiki2/definingviews.rst index 9df72c926..f733abe10 100644 --- a/docs/tutorials/wiki2/definingviews.rst +++ b/docs/tutorials/wiki2/definingviews.rst @@ -10,8 +10,8 @@ The request object has a dictionary as an attribute named ``matchdict``. A ``matchdict`` maps the placeholders in the matching URL ``pattern`` to the substrings of the :term:`request` ed URL. For instance, if a call to :meth:`pyramid.config.Configurator.add_route` has the pattern -``{one}/{two}``, and the URL at ``http://example.com/foo/bar`` is invoked, matching -this pattern, the ``matchdict`` attached to the request would look like: ``{'one':'foo', 'two':'bar'}`` +``{one}/{two}``, and a user visits ``http://example.com/foo/bar``, our pattern would be +matched and the ``matchdict`` would look like: ``{'one':'foo', 'two':'bar'}`` Declaring Dependencies in Our ``setup.py`` File -- cgit v1.2.3 From bb8e20e0d35dc806e19edc6d07c837ec272128ec Mon Sep 17 00:00:00 2001 From: Patrick Canfield Date: Mon, 18 Mar 2013 17:24:51 -0700 Subject: Update definingviews.rst to clarify that a template is a renderer --- docs/tutorials/wiki2/definingviews.rst | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'docs/tutorials/wiki2') diff --git a/docs/tutorials/wiki2/definingviews.rst b/docs/tutorials/wiki2/definingviews.rst index f733abe10..9894bcb08 100644 --- a/docs/tutorials/wiki2/definingviews.rst +++ b/docs/tutorials/wiki2/definingviews.rst @@ -149,10 +149,9 @@ We then generate an edit URL (because it's easier to do here than in the template), and we return a dictionary with a number of arguments. The fact that ``view_page()`` returns a dictionary (as opposed to a :term:`response` object) is a cue to :app:`Pyramid` that it should try to use a :term:`renderer` -associated with the view configuration to render a template. In our case, -the template which will be rendered will be the ``templates/view.pt`` -template, as indicated in the ``@view_config`` decorator that is applied to -``view_page()``. +associated with the view configuration to render a response. In our case, +the renderer used will be the ``templates/view.pt`` template, as indicated in +the ``@view_config`` decorator that is applied to ``view_page()``. The ``add_page`` view function ------------------------------ -- cgit v1.2.3