summaryrefslogtreecommitdiff
path: root/docs/tutorials/wiki2/definingmodels.rst
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2011-03-20 18:08:58 -0400
committerChris McDonough <chrism@plope.com>2011-03-20 18:08:58 -0400
commit6ed41a034df40dcc6632432544742ebefe3162ba (patch)
tree0ba9ce995207e9acf2131a9c84da7e792797cb0c /docs/tutorials/wiki2/definingmodels.rst
parent21d08467e87a5262d97cc64814061d87ed12fbb1 (diff)
downloadpyramid-6ed41a034df40dcc6632432544742ebefe3162ba.tar.gz
pyramid-6ed41a034df40dcc6632432544742ebefe3162ba.tar.bz2
pyramid-6ed41a034df40dcc6632432544742ebefe3162ba.zip
review changes to sqla tutorial
Diffstat (limited to 'docs/tutorials/wiki2/definingmodels.rst')
-rw-r--r--docs/tutorials/wiki2/definingmodels.rst40
1 files changed, 19 insertions, 21 deletions
diff --git a/docs/tutorials/wiki2/definingmodels.rst b/docs/tutorials/wiki2/definingmodels.rst
index 117442a1c..7e8555190 100644
--- a/docs/tutorials/wiki2/definingmodels.rst
+++ b/docs/tutorials/wiki2/definingmodels.rst
@@ -37,28 +37,27 @@ SQLAlchemy models are easier to use than directly-mapped ones.
:language: python
As you can see, our ``Page`` class has a class level attribute
-``__tablename__`` which equals the string ``pages``.
-This means that SQLAlchemy will store our wiki
-data in a SQL table named ``pages``. Our Page class will also have
-class-level attributes named ``id``, ``pagename`` and ``data`` (all instances
-of :class:`sqlalchemy.Column`). These will map to columns in the ``pages``
-table. The ``id`` attribute will be the primary key in the table. The
-``name`` attribute will be a text attribute, each value of which needs to be
-unique within the column. The ``data`` attribute is a text attribute that
-will hold the body of each page.
-
-We'll also remove our ``populate`` function. We'll inline the
-populate step into ``initialize_sql``, changing our ``initialize_sql``
-function to add a FrontPage object to our database at startup time.
+``__tablename__`` which equals the string ``pages``. This means that
+SQLAlchemy will store our wiki data in a SQL table named ``pages``. Our Page
+class will also have class-level attributes named ``id``, ``pagename`` and
+``data`` (all instances of :class:`sqlalchemy.Column`). These will map to
+columns in the ``pages`` table. The ``id`` attribute will be the primary key
+in the table. The ``name`` attribute will be a text attribute, each value of
+which needs to be unique within the column. The ``data`` attribute is a text
+attribute that will hold the body of each page.
+
+We'll also remove our ``populate`` function. We'll inline the populate step
+into ``initialize_sql``, changing our ``initialize_sql`` function to add a
+FrontPage object to our database at startup time.
.. literalinclude:: src/models/tutorial/models.py
:pyobject: initialize_sql
:linenos:
:language: python
-Here, we're using a slightly different binding syntax. It is
-otherwise largely the same as the ``initialize_sql`` in the
-paster-generated ``models.py``.
+Here, we're using a slightly different binding syntax. It is otherwise
+largely the same as the ``initialize_sql`` in the paster-generated
+``models.py``.
Our DBSession assignment stays the same as the original generated
``models.py``.
@@ -76,11 +75,10 @@ something like this:
Viewing the Application in a Browser
------------------------------------
-We can't. At this point, our system is in a "non-runnable" state;
-we'll need to change view-related files in the next chapter to be able
-to start the application successfully. If you try to start the
-application, you'll wind up with a Python traceback on your console
-that ends with this exception:
+We can't. At this point, our system is in a "non-runnable" state; we'll need
+to change view-related files in the next chapter to be able to start the
+application successfully. If you try to start the application, you'll wind
+up with a Python traceback on your console that ends with this exception:
.. code-block:: text