summaryrefslogtreecommitdiff
path: root/docs/tutorials/wiki2/basiclayout.rst
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2013-03-23 03:08:04 -0400
committerChris McDonough <chrism@plope.com>2013-03-23 03:08:04 -0400
commite34541a752384e5fa432c2b14003211dc11f223a (patch)
tree132794de4f52160d99586d91701880ebb6f9ddcd /docs/tutorials/wiki2/basiclayout.rst
parent35d88c65d7b4ca7c75c3cf767be040ff9e0253f9 (diff)
parent79112298e7cb27ee2d80e85429969cb005c31066 (diff)
downloadpyramid-e34541a752384e5fa432c2b14003211dc11f223a.tar.gz
pyramid-e34541a752384e5fa432c2b14003211dc11f223a.tar.bz2
pyramid-e34541a752384e5fa432c2b14003211dc11f223a.zip
Merge branch 'master' of github.com:Pylons/pyramid
Diffstat (limited to 'docs/tutorials/wiki2/basiclayout.rst')
-rw-r--r--docs/tutorials/wiki2/basiclayout.rst30
1 files changed, 13 insertions, 17 deletions
diff --git a/docs/tutorials/wiki2/basiclayout.rst b/docs/tutorials/wiki2/basiclayout.rst
index e8874784c..6d6287126 100644
--- a/docs/tutorials/wiki2/basiclayout.rst
+++ b/docs/tutorials/wiki2/basiclayout.rst
@@ -6,9 +6,6 @@ The starter files generated by the ``alchemy`` scaffold are very basic, but
they provide a good orientation for the high-level patterns common to most
:term:`url dispatch` -based :app:`Pyramid` projects.
-The source code for this tutorial stage can be browsed at
-`http://github.com/Pylons/pyramid/tree/1.3-branch/docs/tutorials/wiki2/src/basiclayout/
-<http://github.com/Pylons/pyramid/tree/1.3-branch/docs/tutorials/wiki2/src/basiclayout/>`_.
Application Configuration with ``__init__.py``
----------------------------------------------
@@ -46,9 +43,9 @@ above is executed. It accepts some settings and returns a :term:`WSGI`
application. (See :ref:`startup_chapter` for more about ``pserve``.)
The main function first creates a :term:`SQLAlchemy` database engine using
-``engine_from_config`` from the ``sqlalchemy.`` prefixed settings in the
-``development.ini`` file's ``[app:main]`` section. This will be a URI
-(something like ``sqlite://``):
+:func:`sqlalchemy.engine_from_config` from the ``sqlalchemy.`` prefixed
+settings in the ``development.ini`` file's ``[app:main]`` section.
+This will be a URI (something like ``sqlite://``):
.. literalinclude:: src/basiclayout/tutorial/__init__.py
:lines: 13
@@ -135,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:
@@ -229,13 +226,12 @@ To give a simple example of a model class, we define one named ``MyModel``:
:linenos:
:language: py
-Our example model has an ``__init__`` method that takes a two arguments
+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.