summaryrefslogtreecommitdiff
path: root/docs/quick_tutorial
diff options
context:
space:
mode:
authorMichael Merickel <michael@merickel.org>2015-10-21 00:34:10 -0500
committerMichael Merickel <michael@merickel.org>2015-10-21 00:34:10 -0500
commit504027873ab0e1b15601e2d1900ef8a4469f6a43 (patch)
tree06e6cbf634a894dbce232c9dbb06324637a95a86 /docs/quick_tutorial
parentbf40a3920278b3e7a01ef5403196b35f45cfcb3c (diff)
parente1ec631ab2d470b1550640d21c28ddd1387f4045 (diff)
downloadpyramid-504027873ab0e1b15601e2d1900ef8a4469f6a43.tar.gz
pyramid-504027873ab0e1b15601e2d1900ef8a4469f6a43.tar.bz2
pyramid-504027873ab0e1b15601e2d1900ef8a4469f6a43.zip
Merge pull request #2020 from bertjwregeer/feature/configurable-view-deriver
Configurable View Deriver moving forward...
Diffstat (limited to 'docs/quick_tutorial')
-rw-r--r--docs/quick_tutorial/authentication.rst5
-rw-r--r--docs/quick_tutorial/authentication/tutorial/home.pt4
-rw-r--r--docs/quick_tutorial/authentication/tutorial/login.pt4
-rw-r--r--docs/quick_tutorial/authorization.rst9
-rw-r--r--docs/quick_tutorial/authorization/tutorial/home.pt4
-rw-r--r--docs/quick_tutorial/authorization/tutorial/login.pt4
-rw-r--r--docs/quick_tutorial/databases.rst44
-rw-r--r--docs/quick_tutorial/databases/development.ini36
-rw-r--r--docs/quick_tutorial/databases/tutorial/tests.py6
-rw-r--r--docs/quick_tutorial/databases/tutorial/wikipage_addedit.pt6
-rw-r--r--docs/quick_tutorial/debugtoolbar.rst32
-rw-r--r--docs/quick_tutorial/forms.rst6
-rw-r--r--docs/quick_tutorial/forms/tutorial/wikipage_addedit.pt2
-rw-r--r--docs/quick_tutorial/functional_testing.rst2
-rw-r--r--docs/quick_tutorial/ini.rst8
-rw-r--r--docs/quick_tutorial/jinja2.rst2
-rw-r--r--docs/quick_tutorial/jinja2/tutorial/home.jinja24
-rw-r--r--docs/quick_tutorial/json/tutorial/home.pt4
-rw-r--r--docs/quick_tutorial/logging.rst23
-rw-r--r--docs/quick_tutorial/logging/tutorial/home.pt4
-rw-r--r--docs/quick_tutorial/more_view_classes.rst21
-rw-r--r--docs/quick_tutorial/more_view_classes/tutorial/delete.pt4
-rw-r--r--docs/quick_tutorial/more_view_classes/tutorial/edit.pt4
-rw-r--r--docs/quick_tutorial/more_view_classes/tutorial/hello.pt4
-rw-r--r--docs/quick_tutorial/more_view_classes/tutorial/home.pt4
-rw-r--r--docs/quick_tutorial/package.rst4
-rw-r--r--docs/quick_tutorial/request_response.rst3
-rw-r--r--docs/quick_tutorial/requirements.rst36
-rw-r--r--docs/quick_tutorial/routing.rst2
-rw-r--r--docs/quick_tutorial/routing/tutorial/home.pt4
-rw-r--r--docs/quick_tutorial/sessions.rst2
-rw-r--r--docs/quick_tutorial/sessions/tutorial/home.pt4
-rw-r--r--docs/quick_tutorial/static_assets.rst2
-rw-r--r--docs/quick_tutorial/static_assets/tutorial/home.pt4
-rw-r--r--docs/quick_tutorial/templating.rst2
-rw-r--r--docs/quick_tutorial/templating/tutorial/home.pt4
-rw-r--r--docs/quick_tutorial/unit_testing.rst2
-rw-r--r--docs/quick_tutorial/view_classes.rst4
-rw-r--r--docs/quick_tutorial/views.rst2
39 files changed, 198 insertions, 123 deletions
diff --git a/docs/quick_tutorial/authentication.rst b/docs/quick_tutorial/authentication.rst
index 4b4eb1ba3..7fd8173d4 100644
--- a/docs/quick_tutorial/authentication.rst
+++ b/docs/quick_tutorial/authentication.rst
@@ -93,7 +93,7 @@ Steps
Analysis
========
-Unlike many web frameworks, Pyramid includes a built-in (but optional)
+Unlike many web frameworks, Pyramid includes a built-in but optional
security model for authentication and authorization. This security
system is intended to be flexible and support many needs. In this
security model, authentication (who are you) and authorization (what
@@ -123,9 +123,6 @@ Extra Credit
#. Can I use a database behind my ``groupfinder`` to look up principals?
-#. Do I have to put a ``renderer`` in my ``@forbidden_view_config``
- decorator?
-
#. Once I am logged in, does any user-centric information get jammed
onto each request? Use ``import pdb; pdb.set_trace()`` to answer
this.
diff --git a/docs/quick_tutorial/authentication/tutorial/home.pt b/docs/quick_tutorial/authentication/tutorial/home.pt
index 6ecd0081b..ed911b673 100644
--- a/docs/quick_tutorial/authentication/tutorial/home.pt
+++ b/docs/quick_tutorial/authentication/tutorial/home.pt
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
- <title>Quick Tour: ${name}</title>
+ <title>Quick Tutorial: ${name}</title>
</head>
<body>
@@ -15,4 +15,4 @@
<h1>Hi ${name}</h1>
<p>Visit <a href="${request.route_url('hello')}">hello</a></p>
</body>
-</html> \ No newline at end of file
+</html>
diff --git a/docs/quick_tutorial/authentication/tutorial/login.pt b/docs/quick_tutorial/authentication/tutorial/login.pt
index 4451fc4f8..9e5bfe2ad 100644
--- a/docs/quick_tutorial/authentication/tutorial/login.pt
+++ b/docs/quick_tutorial/authentication/tutorial/login.pt
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
- <title>Quick Tour: ${name}</title>
+ <title>Quick Tutorial: ${name}</title>
</head>
<body>
<h1>Login</h1>
@@ -22,4 +22,4 @@
value="Log In"/>
</form>
</body>
-</html> \ No newline at end of file
+</html>
diff --git a/docs/quick_tutorial/authorization.rst b/docs/quick_tutorial/authorization.rst
index 6b10d3409..855043f7f 100644
--- a/docs/quick_tutorial/authorization.rst
+++ b/docs/quick_tutorial/authorization.rst
@@ -11,7 +11,7 @@ Background
Our application has URLs that allow people to add/edit/delete content
via a web browser. Time to add security to the application. Let's
protect our add/edit views to require a login (username of
-``editor`` and password of ``editor``.) We will allow the other views
+``editor`` and password of ``editor``). We will allow the other views
to continue working without a password.
Objectives
@@ -93,7 +93,7 @@ In summary: ``hello`` wants ``edit`` permission, ``Root`` says
Of course, this only applies on ``Root``. Some other part of the site
(a.k.a. *context*) might have a different ACL.
-If you are not logged in and visit ``/hello``, you need to get
+If you are not logged in and visit ``/howdy``, you need to get
shown the login screen. How does Pyramid know what is the login page to
use? We explicitly told Pyramid that the ``login`` view should be used
by decorating the view with ``@forbidden_view_config``.
@@ -101,7 +101,10 @@ by decorating the view with ``@forbidden_view_config``.
Extra Credit
============
-#. Perhaps you would like experience of not having enough permissions
+#. Do I have to put a ``renderer`` in my ``@forbidden_view_config``
+ decorator?
+
+#. Perhaps you would like the experience of not having enough permissions
(forbidden) to be richer. How could you change this?
#. Perhaps we want to store security statements in a database and
diff --git a/docs/quick_tutorial/authorization/tutorial/home.pt b/docs/quick_tutorial/authorization/tutorial/home.pt
index 6ecd0081b..ed911b673 100644
--- a/docs/quick_tutorial/authorization/tutorial/home.pt
+++ b/docs/quick_tutorial/authorization/tutorial/home.pt
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
- <title>Quick Tour: ${name}</title>
+ <title>Quick Tutorial: ${name}</title>
</head>
<body>
@@ -15,4 +15,4 @@
<h1>Hi ${name}</h1>
<p>Visit <a href="${request.route_url('hello')}">hello</a></p>
</body>
-</html> \ No newline at end of file
+</html>
diff --git a/docs/quick_tutorial/authorization/tutorial/login.pt b/docs/quick_tutorial/authorization/tutorial/login.pt
index 4451fc4f8..9e5bfe2ad 100644
--- a/docs/quick_tutorial/authorization/tutorial/login.pt
+++ b/docs/quick_tutorial/authorization/tutorial/login.pt
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
- <title>Quick Tour: ${name}</title>
+ <title>Quick Tutorial: ${name}</title>
</head>
<body>
<h1>Login</h1>
@@ -22,4 +22,4 @@
value="Log In"/>
</form>
</body>
-</html> \ No newline at end of file
+</html>
diff --git a/docs/quick_tutorial/databases.rst b/docs/quick_tutorial/databases.rst
index 7c019dbfc..19dfd066d 100644
--- a/docs/quick_tutorial/databases.rst
+++ b/docs/quick_tutorial/databases.rst
@@ -53,8 +53,8 @@ Steps
.. note::
- We aren't yet doing ``python3.3 setup.py develop`` as we
- are changing it later.
+ We aren't yet doing ``$VENV/bin/python setup.py develop`` as we
+ will change it later.
#. Our configuration file at ``databases/development.ini`` wires
together some new pieces:
@@ -72,6 +72,7 @@ Steps
to initialize the database:
.. literalinclude:: databases/tutorial/initialize_db.py
+ :linenos:
#. Since ``setup.py`` changed, we now run it:
@@ -89,21 +90,34 @@ Steps
.. code-block:: bash
$ $VENV/bin/initialize_tutorial_db development.ini
- 2013-09-06 15:54:08,050 INFO [sqlalchemy.engine.base.Engine][MainThread] PRAGMA table_info("wikipages")
- 2013-09-06 15:54:08,050 INFO [sqlalchemy.engine.base.Engine][MainThread] ()
- 2013-09-06 15:54:08,051 INFO [sqlalchemy.engine.base.Engine][MainThread]
+ 2015-06-01 11:22:52,650 INFO [sqlalchemy.engine.base.Engine][MainThread] SELECT CAST('test plain returns' AS VARCHAR(60)) AS anon_1
+ 2015-06-01 11:22:52,650 INFO [sqlalchemy.engine.base.Engine][MainThread] ()
+ 2015-06-01 11:22:52,651 INFO [sqlalchemy.engine.base.Engine][MainThread] SELECT CAST('test unicode returns' AS VARCHAR(60)) AS anon_1
+ 2015-06-01 11:22:52,651 INFO [sqlalchemy.engine.base.Engine][MainThread] ()
+ 2015-06-01 11:22:52,652 INFO [sqlalchemy.engine.base.Engine][MainThread] PRAGMA table_info("wikipages")
+ 2015-06-01 11:22:52,652 INFO [sqlalchemy.engine.base.Engine][MainThread] ()
+ 2015-06-01 11:22:52,653 INFO [sqlalchemy.engine.base.Engine][MainThread]
CREATE TABLE wikipages (
- uid INTEGER NOT NULL,
- title TEXT,
- body TEXT,
- PRIMARY KEY (uid),
- UNIQUE (title)
+ uid INTEGER NOT NULL,
+ title TEXT,
+ body TEXT,
+ PRIMARY KEY (uid),
+ UNIQUE (title)
)
+
+ 2015-06-01 11:22:52,653 INFO [sqlalchemy.engine.base.Engine][MainThread] ()
+ 2015-06-01 11:22:52,655 INFO [sqlalchemy.engine.base.Engine][MainThread] COMMIT
+ 2015-06-01 11:22:52,658 INFO [sqlalchemy.engine.base.Engine][MainThread] BEGIN (implicit)
+ 2015-06-01 11:22:52,659 INFO [sqlalchemy.engine.base.Engine][MainThread] INSERT INTO wikipages (title, body) VALUES (?, ?)
+ 2015-06-01 11:22:52,659 INFO [sqlalchemy.engine.base.Engine][MainThread] ('Root', '<p>Root</p>')
+ 2015-06-01 11:22:52,659 INFO [sqlalchemy.engine.base.Engine][MainThread] COMMIT
+
#. With our data now driven by SQLAlchemy queries, we need to update
our ``databases/tutorial/views.py``:
.. literalinclude:: databases/tutorial/views.py
+ :linenos:
#. Our tests in ``databases/tutorial/tests.py`` changed to include
SQLAlchemy bootstrapping:
@@ -138,8 +152,8 @@ Let's start with the dependencies. We made the decision to use
``pyramid_tm`` and ``zope.sqlalchemy``. Why?
Pyramid has a strong orientation towards support for ``transactions``.
-Specifically, you can install a transaction manager into your app
-application, either as middleware or a Pyramid "tween". Then,
+Specifically, you can install a transaction manager into your
+application either as middleware or a Pyramid "tween". Then,
just before you return the response, all transaction-aware parts of
your application are executed.
@@ -149,7 +163,7 @@ aborts the transaction. This is a very liberating way to write code.
The ``pyramid_tm`` package provides a "tween" that is configured in the
``development.ini`` configuration file. That installs it. We then need
-a package that makes SQLAlchemy and thus the RDBMS transaction manager
+a package that makes SQLAlchemy, and thus the RDBMS transaction manager,
integrate with the Pyramid transaction manager. That's what
``zope.sqlalchemy`` does.
@@ -167,8 +181,8 @@ console script follows the pattern of being fed a configuration file
with all the bootstrapping. It then opens SQLAlchemy and creates the
root of the wiki, which also makes the SQLite file. Note the
``with transaction.manager`` part that puts the work in the scope of a
-transaction (as we aren't inside a web request where this is done
-automatically.)
+transaction, as we aren't inside a web request where this is done
+automatically.
The ``models.py`` does a little bit extra work to hook up SQLAlchemy
into the Pyramid transaction manager. It then declares the model for a
diff --git a/docs/quick_tutorial/databases/development.ini b/docs/quick_tutorial/databases/development.ini
index 04c249a62..5da87d602 100644
--- a/docs/quick_tutorial/databases/development.ini
+++ b/docs/quick_tutorial/databases/development.ini
@@ -11,3 +11,39 @@ sqlalchemy.url = sqlite:///%(here)s/sqltutorial.sqlite
use = egg:pyramid#wsgiref
host = 0.0.0.0
port = 6543
+
+# Begin logging configuration
+
+[loggers]
+keys = root, tutorial, sqlalchemy.engine.base.Engine
+
+[logger_tutorial]
+level = DEBUG
+handlers =
+qualname = tutorial
+
+[handlers]
+keys = console
+
+[formatters]
+keys = generic
+
+[logger_root]
+level = INFO
+handlers = console
+
+[logger_sqlalchemy.engine.base.Engine]
+level = INFO
+handlers =
+qualname = sqlalchemy.engine.base.Engine
+
+[handler_console]
+class = StreamHandler
+args = (sys.stderr,)
+level = NOTSET
+formatter = generic
+
+[formatter_generic]
+format = %(asctime)s %(levelname)-5.5s [%(name)s][%(threadName)s] %(message)s
+
+# End logging configuration
diff --git a/docs/quick_tutorial/databases/tutorial/tests.py b/docs/quick_tutorial/databases/tutorial/tests.py
index e18e70c8c..11e747d15 100644
--- a/docs/quick_tutorial/databases/tutorial/tests.py
+++ b/docs/quick_tutorial/databases/tutorial/tests.py
@@ -40,16 +40,14 @@ class WikiViewTests(unittest.TestCase):
class WikiFunctionalTests(unittest.TestCase):
def setUp(self):
- self.session = _initTestingDB()
- self.config = testing.setUp()
from pyramid.paster import get_app
app = get_app('development.ini')
from webtest import TestApp
self.testapp = TestApp(app)
def tearDown(self):
- self.session.remove()
- testing.tearDown()
+ from .models import DBSession
+ DBSession.remove()
def test_it(self):
res = self.testapp.get('/', status=200)
diff --git a/docs/quick_tutorial/databases/tutorial/wikipage_addedit.pt b/docs/quick_tutorial/databases/tutorial/wikipage_addedit.pt
index d1fea0d7f..01955ef72 100644
--- a/docs/quick_tutorial/databases/tutorial/wikipage_addedit.pt
+++ b/docs/quick_tutorial/databases/tutorial/wikipage_addedit.pt
@@ -4,10 +4,12 @@
<title>WikiPage: Add/Edit</title>
<tal:block tal:repeat="reqt view.reqts['css']">
<link rel="stylesheet" type="text/css"
- href="${request.static_url('deform:static/' + reqt)}"/>
+ href="${request.static_url(reqt)}">
</tal:block>
+ <script type="text/javascript"
+ src="${request.static_url('deform:static/scripts/jquery-2.0.3.min.js')}"></script>
<tal:block tal:repeat="reqt view.reqts['js']">
- <script src="${request.static_url('deform:static/' + reqt)}"
+ <script src="${request.static_url(reqt)}"
type="text/javascript"></script>
</tal:block>
</head>
diff --git a/docs/quick_tutorial/debugtoolbar.rst b/docs/quick_tutorial/debugtoolbar.rst
index d138eb760..f11abc493 100644
--- a/docs/quick_tutorial/debugtoolbar.rst
+++ b/docs/quick_tutorial/debugtoolbar.rst
@@ -74,11 +74,11 @@ You'll now see an attractive button on the right side of your browser, which
you may click to provide introspective access to debugging information in a
new browser tab. Even better, if your web application generates an error, you
will see a nice traceback on the screen. When you want to disable this
-toolbar, no need to change code: you can remove it from ``pyramid.includes``
-in the relevant ``.ini`` configuration file (thus showing why configuration
-files are handy.)
+toolbar, there's no need to change code: you can remove it from
+``pyramid.includes`` in the relevant ``.ini`` configuration file (thus showing
+why configuration files are handy.)
-Note that the toolbar injects a small amount of html/css into your app just
+Note that the toolbar injects a small amount of HTML/CSS into your app just
before the closing ``</body>`` tag in order to display itself. If you start to
experience otherwise inexplicable client-side weirdness, you can shut it off
by commenting out the ``pyramid_debugtoolbar`` line in ``pyramid.includes``
@@ -89,24 +89,24 @@ temporarily.
Extra Credit
============
-# Why don't we add ``pyramid_debugtoolbar`` to the list of
- ``install_requires`` dependencies in ``debugtoolbar/setup.py``?
+#. Why don't we add ``pyramid_debugtoolbar`` to the list of
+ ``install_requires`` dependencies in ``debugtoolbar/setup.py``?
-# Introduce a bug into your application: Change:
+#. Introduce a bug into your application: Change:
- .. code-block:: python
+ .. code-block:: python
- def hello_world(request):
- return Response('<body><h1>Hello World!</h1></body>')
+ def hello_world(request):
+ return Response('<body><h1>Hello World!</h1></body>')
- to:
+ to:
- .. code-block:: python
+ .. code-block:: python
def hello_world(request):
return xResponse('<body><h1>Hello World!</h1></body>')
- Save, and visit http://localhost:6543/ again. Notice the nice
- traceback display. On the lowest line, click the "screen" icon to the
- right, and try typing the variable names ``request`` and ``Response``.
- What else can you discover?
+ Save, and visit http://localhost:6543/ again. Notice the nice
+ traceback display. On the lowest line, click the "screen" icon to the
+ right, and try typing the variable names ``request`` and ``Response``.
+ What else can you discover?
diff --git a/docs/quick_tutorial/forms.rst b/docs/quick_tutorial/forms.rst
index b08167edc..f81b88fc2 100644
--- a/docs/quick_tutorial/forms.rst
+++ b/docs/quick_tutorial/forms.rst
@@ -12,13 +12,13 @@ Background
Modern web applications deal extensively with forms. Developers,
though, have a wide range of philosophies about how frameworks should
help them with their forms. As such, Pyramid doesn't directly bundle
-one particular form library. Instead, there are a variety of form
+one particular form library. Instead there are a variety of form
libraries that are easy to use in Pyramid.
:ref:`Deform <deform:overview>`
is one such library. In this step, we introduce Deform for our
-forms and validation. This also gives us the
-:ref:`Colander <colander:overview>` for schemas and validation.
+forms and validation. This also gives us :ref:`Colander <colander:overview>`
+for schemas and validation.
Deform is getting a facelift, with styling from Twitter Bootstrap and
advanced widgets from popular JavaScript projects. The work began in
diff --git a/docs/quick_tutorial/forms/tutorial/wikipage_addedit.pt b/docs/quick_tutorial/forms/tutorial/wikipage_addedit.pt
index 3292dfd90..547465018 100644
--- a/docs/quick_tutorial/forms/tutorial/wikipage_addedit.pt
+++ b/docs/quick_tutorial/forms/tutorial/wikipage_addedit.pt
@@ -6,6 +6,8 @@
<link rel="stylesheet" type="text/css"
href="${request.static_url(reqt)}"/>
</tal:block>
+ <script src="${request.static_url('deform:static/scripts/jquery-2.0.3.min.js')}"
+ type="text/javascript"></script>
<tal:block tal:repeat="reqt view.reqts['js']">
<script src="${request.static_url(reqt)}"
type="text/javascript"></script>
diff --git a/docs/quick_tutorial/functional_testing.rst b/docs/quick_tutorial/functional_testing.rst
index 09b05b0bc..6f1544e79 100644
--- a/docs/quick_tutorial/functional_testing.rst
+++ b/docs/quick_tutorial/functional_testing.rst
@@ -10,7 +10,7 @@ Background
==========
Unit tests are a common and popular approach to test-driven development
-(TDD.) In web applications, though, the templating and entire apparatus
+(TDD). In web applications, though, the templating and entire apparatus
of a web site are important parts of the delivered quality. We'd like a
way to test these.
diff --git a/docs/quick_tutorial/ini.rst b/docs/quick_tutorial/ini.rst
index b8720711b..36942c767 100644
--- a/docs/quick_tutorial/ini.rst
+++ b/docs/quick_tutorial/ini.rst
@@ -88,7 +88,7 @@ the Pyramid chapter on
- ``pserve`` looks for ``[app:main]`` and finds ``use = egg:tutorial``
-- The projects's ``setup.py`` has defined an "entry point" (lines 9-10)
+- The projects's ``setup.py`` has defined an "entry point" (lines 9-12)
for the project "main" entry point of ``tutorial:main``
- The ``tutorial`` package's ``__init__`` has a ``main`` function
@@ -131,6 +131,8 @@ Extra Credit
#. The entry point in ``setup.py`` didn't mention ``__init__.py`` when
it declared ``tutorial:main`` function. Why not?
+#. What is the purpose of ``**settings``? What does the ``**`` signify?
+
.. seealso::
:ref:`project_narr`,
:ref:`scaffolding_chapter`,
@@ -138,7 +140,3 @@ Extra Credit
:ref:`environment_chapter`,
:ref:`paste_chapter`
-Extra Credit
-============
-
-#. What is the purpose of ``**settings``? What does the ``**`` signify?
diff --git a/docs/quick_tutorial/jinja2.rst b/docs/quick_tutorial/jinja2.rst
index 613542349..2121803f9 100644
--- a/docs/quick_tutorial/jinja2.rst
+++ b/docs/quick_tutorial/jinja2.rst
@@ -6,7 +6,7 @@
We just said Pyramid doesn't prefer one templating language over
another. Time to prove it. Jinja2 is a popular templating system,
-used in Flask and modelled after Django's templates. Let's add
+used in Flask and modeled after Django's templates. Let's add
``pyramid_jinja2``, a Pyramid :term:`add-on` which enables Jinja2 as a
:term:`renderer` in our Pyramid applications.
diff --git a/docs/quick_tutorial/jinja2/tutorial/home.jinja2 b/docs/quick_tutorial/jinja2/tutorial/home.jinja2
index 975323169..20d33b733 100644
--- a/docs/quick_tutorial/jinja2/tutorial/home.jinja2
+++ b/docs/quick_tutorial/jinja2/tutorial/home.jinja2
@@ -1,9 +1,9 @@
<!DOCTYPE html>
<html lang="en">
<head>
- <title>Quick Tour: {{ name }}</title>
+ <title>Quick Tutorial: {{ name }}</title>
</head>
<body>
<h1>Hi {{ name }}</h1>
</body>
-</html> \ No newline at end of file
+</html>
diff --git a/docs/quick_tutorial/json/tutorial/home.pt b/docs/quick_tutorial/json/tutorial/home.pt
index a0cc08e7a..fd4ef8764 100644
--- a/docs/quick_tutorial/json/tutorial/home.pt
+++ b/docs/quick_tutorial/json/tutorial/home.pt
@@ -1,9 +1,9 @@
<!DOCTYPE html>
<html lang="en">
<head>
- <title>Quick Tour: ${name}</title>
+ <title>Quick Tutorial: ${name}</title>
</head>
<body>
<h1>Hi ${name}</h1>
</body>
-</html> \ No newline at end of file
+</html>
diff --git a/docs/quick_tutorial/logging.rst b/docs/quick_tutorial/logging.rst
index e07d23d6d..5d29cd196 100644
--- a/docs/quick_tutorial/logging.rst
+++ b/docs/quick_tutorial/logging.rst
@@ -16,9 +16,9 @@ we might need to detect problems when other people use the site. We
need *logging*.
Fortunately Pyramid uses the normal Python approach to logging. The
-scaffold generated, in your ``development.ini``, has a number of lines that
+scaffold generated in your ``development.ini`` has a number of lines that
configure the logging for you to some reasonable defaults. You then see
-messages sent by Pyramid (for example, when a new request comes in.)
+messages sent by Pyramid, for example, when a new request comes in.
Objectives
==========
@@ -42,6 +42,12 @@ Steps
.. literalinclude:: logging/tutorial/views.py
:linenos:
+#. Finally let's edit ``development.ini`` configuration file
+ to enable logging for our Pyramid application:
+
+ .. literalinclude:: logging/development.ini
+ :language: ini
+
#. Make sure the tests still pass:
.. code-block:: bash
@@ -61,15 +67,10 @@ Steps
Analysis
========
-Our ``development.ini`` configuration file wires up Python standard
-logging for our Pyramid application:
-
-.. literalinclude:: logging/development.ini
- :language: ini
-
-In this, our ``tutorial`` Python package is setup as a logger
-and configured to log messages at a ``DEBUG`` or higher level. When you
-visit http://localhost:6543 your console will now show::
+In our configuration file ``development.ini``, our ``tutorial`` Python
+package is setup as a logger and configured to log messages at a
+``DEBUG`` or higher level. When you visit http://localhost:6543 your
+console will now show::
2013-08-09 10:42:42,968 DEBUG [tutorial.views][MainThread] In home view
diff --git a/docs/quick_tutorial/logging/tutorial/home.pt b/docs/quick_tutorial/logging/tutorial/home.pt
index a0cc08e7a..fd4ef8764 100644
--- a/docs/quick_tutorial/logging/tutorial/home.pt
+++ b/docs/quick_tutorial/logging/tutorial/home.pt
@@ -1,9 +1,9 @@
<!DOCTYPE html>
<html lang="en">
<head>
- <title>Quick Tour: ${name}</title>
+ <title>Quick Tutorial: ${name}</title>
</head>
<body>
<h1>Hi ${name}</h1>
</body>
-</html> \ No newline at end of file
+</html>
diff --git a/docs/quick_tutorial/more_view_classes.rst b/docs/quick_tutorial/more_view_classes.rst
index 9cc4cc520..afbb7cc3a 100644
--- a/docs/quick_tutorial/more_view_classes.rst
+++ b/docs/quick_tutorial/more_view_classes.rst
@@ -47,7 +47,7 @@ Objectives
- Dispatch one route/URL to multiple views based on request data
-- Share stated and logic between views and templates via the view class
+- Share states and logic between views and templates via the view class
Steps
=====
@@ -95,6 +95,23 @@ Steps
.. literalinclude:: more_view_classes/tutorial/delete.pt
:language: html
+#. Our tests in ``more_view_classes/tutorial/tests.py`` fail, so let's modify
+ them:
+
+ .. literalinclude:: more_view_classes/tutorial/tests.py
+ :linenos:
+
+#. Now run the tests:
+
+ .. code-block:: bash
+
+ $ $VENV/bin/nosetests tutorial
+ .
+ ----------------------------------------------------------------------
+ Ran 2 tests in 0.248s
+
+ OK
+
#. Run your Pyramid application with:
.. code-block:: bash
@@ -125,7 +142,7 @@ Specifically:
- The fourth view is returned when clicking on a button such
as ``<input type="submit" name="form.delete" value="Delete"/>``.
-In this step we show using the following information as criteria to
+In this step we show, using the following information as criteria, how to
decide which view to use:
- Method of the HTTP request (``GET``, ``POST``, etc.)
diff --git a/docs/quick_tutorial/more_view_classes/tutorial/delete.pt b/docs/quick_tutorial/more_view_classes/tutorial/delete.pt
index 67cc8bf09..7bd4d3b0d 100644
--- a/docs/quick_tutorial/more_view_classes/tutorial/delete.pt
+++ b/docs/quick_tutorial/more_view_classes/tutorial/delete.pt
@@ -1,9 +1,9 @@
<!DOCTYPE html>
<html lang="en">
<head>
- <title>Quick Tour: ${page_title}</title>
+ <title>Quick Tutorial: ${page_title}</title>
</head>
<body>
<h1>${view.view_name} - ${page_title}</h1>
</body>
-</html> \ No newline at end of file
+</html>
diff --git a/docs/quick_tutorial/more_view_classes/tutorial/edit.pt b/docs/quick_tutorial/more_view_classes/tutorial/edit.pt
index 1bd204065..523a4ce5d 100644
--- a/docs/quick_tutorial/more_view_classes/tutorial/edit.pt
+++ b/docs/quick_tutorial/more_view_classes/tutorial/edit.pt
@@ -1,10 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
- <title>Quick Tour: ${view.view_name} - ${page_title}</title>
+ <title>Quick Tutorial: ${view.view_name} - ${page_title}</title>
</head>
<body>
<h1>${view.view_name} - ${page_title}</h1>
<p>You submitted <code>${new_name}</code></p>
</body>
-</html> \ No newline at end of file
+</html>
diff --git a/docs/quick_tutorial/more_view_classes/tutorial/hello.pt b/docs/quick_tutorial/more_view_classes/tutorial/hello.pt
index 8a39aed09..40b00bfe4 100644
--- a/docs/quick_tutorial/more_view_classes/tutorial/hello.pt
+++ b/docs/quick_tutorial/more_view_classes/tutorial/hello.pt
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
- <title>Quick Tour: ${view.view_name} - ${page_title}</title>
+ <title>Quick Tutorial: ${view.view_name} - ${page_title}</title>
</head>
<body>
<h1>${view.view_name} - ${page_title}</h1>
@@ -13,4 +13,4 @@
<input type="submit" name="form.delete" value="Delete"/>
</form>
</body>
-</html> \ No newline at end of file
+</html>
diff --git a/docs/quick_tutorial/more_view_classes/tutorial/home.pt b/docs/quick_tutorial/more_view_classes/tutorial/home.pt
index fa9016705..fa0436f7e 100644
--- a/docs/quick_tutorial/more_view_classes/tutorial/home.pt
+++ b/docs/quick_tutorial/more_view_classes/tutorial/home.pt
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
- <title>Quick Tour: ${view.view_name} - ${page_title}</title>
+ <title>Quick Tutorial: ${view.view_name} - ${page_title}</title>
</head>
<body>
<h1>${view.view_name} - ${page_title}</h1>
@@ -9,4 +9,4 @@
<p>Go to the <a href="${request.route_url('hello', first='jane',
last='doe')}">form</a>.</p>
</body>
-</html> \ No newline at end of file
+</html>
diff --git a/docs/quick_tutorial/package.rst b/docs/quick_tutorial/package.rst
index 8fb052d5b..54a6a0bd9 100644
--- a/docs/quick_tutorial/package.rst
+++ b/docs/quick_tutorial/package.rst
@@ -3,7 +3,7 @@
============================================
Most modern Python development is done using Python packages, an approach
-Pyramid puts to good use. In this step we re-do "Hello World" as a
+Pyramid puts to good use. In this step we redo "Hello World" as a
minimum Python package inside a minimum Python project.
Background
@@ -93,7 +93,7 @@ Python projects, via ``setup.py``, gives us special features when
our package is installed (in this case, in local development mode.)
In this step we have a Python package called ``tutorial``. We use the
-same name in each step of the tutorial, to avoid unnecessary re-typing.
+same name in each step of the tutorial, to avoid unnecessary retyping.
Above this ``tutorial`` directory we have the files that handle the
packaging of this project. At the moment, all we need is a
diff --git a/docs/quick_tutorial/request_response.rst b/docs/quick_tutorial/request_response.rst
index 504803804..4f8de0221 100644
--- a/docs/quick_tutorial/request_response.rst
+++ b/docs/quick_tutorial/request_response.rst
@@ -46,14 +46,17 @@ Steps
#. Simplify the routes in ``request_response/tutorial/__init__.py``:
.. literalinclude:: request_response/tutorial/__init__.py
+ :linenos:
#. We only need one view in ``request_response/tutorial/views.py``:
.. literalinclude:: request_response/tutorial/views.py
+ :linenos:
#. Update the tests in ``request_response/tutorial/tests.py``:
.. literalinclude:: request_response/tutorial/tests.py
+ :linenos:
#. Now run the tests:
diff --git a/docs/quick_tutorial/requirements.rst b/docs/quick_tutorial/requirements.rst
index b5778ea42..a737ede0e 100644
--- a/docs/quick_tutorial/requirements.rst
+++ b/docs/quick_tutorial/requirements.rst
@@ -58,11 +58,8 @@ Steps
Install Python 3.3 or greater
-----------------------------
-Download the latest standard Python 3.3+ release (not development
-release) from
-`python.org <http://www.python.org/download/releases/>`_. On that page, you
-must click the latest version, then scroll down to the "Downloads" section
-for your operating system.
+Download the latest standard Python 3.3+ release (not development release)
+from `python.org <https://www.python.org/downloads/>`_.
Windows and Mac OS X users can download and run an installer.
@@ -73,8 +70,7 @@ directions. Make sure you get the proper 32- or 64-bit build and Python
version.
Linux users can either use their package manager to install Python 3.3
-or may
-`build Python 3.3 from source
+or may `build Python 3.3 from source
<http://pyramid.readthedocs.org/en/master/narr/install.html#package-manager-
method>`_.
@@ -86,13 +82,21 @@ Create a project directory structure
We will arrive at a directory structure of
``workspace->project->package``, with our workspace named
-``quick_tutorial``. The following diagram shows how this is structured
-and where our virtual environment will reside:
-
-.. figure:: ../_static/directory_structure_pyramid.png
- :alt: Final directory structure
-
- Final directory structure.
+``quick_tutorial``. The following tree diagram shows how this will be
+structured and where our virtual environment will reside as we proceed through
+the tutorial:
+
+.. code-block:: text
+
+ └── ~
+ └── projects
+ └── quick_tutorial
+ ├── env
+ └── step_one
+ ├── intro
+ │ ├── __init__.py
+ │ └── app.py
+ └── setup.py
For Linux, the commands to do so are as follows:
@@ -136,11 +140,11 @@ environment. We set an environment variable to save typing later.
.. code-block:: bash
# Mac and Linux
- $ export VENV=~/projects/quick_tutorial/env33/
+ $ export VENV=~/projects/quick_tutorial/env
# Windows
# TODO: This command does not work
- c:\> set VENV=c:\projects\quick_tutorial\env33
+ c:\> set VENV=c:\projects\quick_tutorial\env
.. _create-a-virtual-environment:
diff --git a/docs/quick_tutorial/routing.rst b/docs/quick_tutorial/routing.rst
index 54dff5c39..1b79a5889 100644
--- a/docs/quick_tutorial/routing.rst
+++ b/docs/quick_tutorial/routing.rst
@@ -14,7 +14,7 @@ Writing web applications usually means sophisticated URL design. We
just saw some Pyramid machinery for requests and views. Let's look at
features that help in routing.
-Previously we saw the basics of routing URLs to views in
+Previously we saw the basics of routing URLs to views in Pyramid.
- Your project's "setup" code registers a route name to be used when
matching part of the URL
diff --git a/docs/quick_tutorial/routing/tutorial/home.pt b/docs/quick_tutorial/routing/tutorial/home.pt
index f2b991059..b68e96338 100644
--- a/docs/quick_tutorial/routing/tutorial/home.pt
+++ b/docs/quick_tutorial/routing/tutorial/home.pt
@@ -1,10 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
- <title>Quick Tour: ${name}</title>
+ <title>Quick Tutorial: ${name}</title>
</head>
<body>
<h1>${name}</h1>
<p>First: ${first}, Last: ${last}</p>
</body>
-</html> \ No newline at end of file
+</html>
diff --git a/docs/quick_tutorial/sessions.rst b/docs/quick_tutorial/sessions.rst
index b4887beb8..f97405500 100644
--- a/docs/quick_tutorial/sessions.rst
+++ b/docs/quick_tutorial/sessions.rst
@@ -89,7 +89,7 @@ when you add an item using a form ``POST``, the site usually issues a
second HTTP Redirect web request to view the new item. You might want a
message to appear after that second web request saying "Your item was
added." You can't just return it in the web response for the POST,
-as it will be tossed out during the second web requests.
+as it will be tossed out during the second web request.
Flash messages are a technique where messages can be stored between
requests, using sessions, then removed when they finally get displayed.
diff --git a/docs/quick_tutorial/sessions/tutorial/home.pt b/docs/quick_tutorial/sessions/tutorial/home.pt
index 0b27ba1d8..50342e52f 100644
--- a/docs/quick_tutorial/sessions/tutorial/home.pt
+++ b/docs/quick_tutorial/sessions/tutorial/home.pt
@@ -1,10 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
- <title>Quick Tour: ${name}</title>
+ <title>Quick Tutorial: ${name}</title>
</head>
<body>
<h1>Hi ${name}</h1>
<p>Count: ${view.counter}</p>
</body>
-</html> \ No newline at end of file
+</html>
diff --git a/docs/quick_tutorial/static_assets.rst b/docs/quick_tutorial/static_assets.rst
index 19d33f00f..3a7496ec7 100644
--- a/docs/quick_tutorial/static_assets.rst
+++ b/docs/quick_tutorial/static_assets.rst
@@ -25,7 +25,7 @@ Steps
$ cd ..; cp -r view_classes static_assets; cd static_assets
$ $VENV/bin/python setup.py develop
-#. We add a call ``config.add_static_view in
+#. We add a call ``config.add_static_view`` in
``static_assets/tutorial/__init__.py``:
.. literalinclude:: static_assets/tutorial/__init__.py
diff --git a/docs/quick_tutorial/static_assets/tutorial/home.pt b/docs/quick_tutorial/static_assets/tutorial/home.pt
index 5d347f057..57867a1ff 100644
--- a/docs/quick_tutorial/static_assets/tutorial/home.pt
+++ b/docs/quick_tutorial/static_assets/tutorial/home.pt
@@ -1,11 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
- <title>Quick Tour: ${name}</title>
+ <title>Quick Tutorial: ${name}</title>
<link rel="stylesheet"
href="${request.static_url('tutorial:static/app.css') }"/>
</head>
<body>
<h1>Hi ${name}</h1>
</body>
-</html> \ No newline at end of file
+</html>
diff --git a/docs/quick_tutorial/templating.rst b/docs/quick_tutorial/templating.rst
index d73067f48..cf56d2a96 100644
--- a/docs/quick_tutorial/templating.rst
+++ b/docs/quick_tutorial/templating.rst
@@ -112,7 +112,7 @@ Analysis
Ahh, that looks better. We have a view that is focused on Python code.
Our ``@view_config`` decorator specifies a :term:`renderer` that points
-our template file. Our view then simply returns data which is then
+to our template file. Our view then simply returns data which is then
supplied to our template. Note that we used the same template for both
views.
diff --git a/docs/quick_tutorial/templating/tutorial/home.pt b/docs/quick_tutorial/templating/tutorial/home.pt
index a0cc08e7a..fd4ef8764 100644
--- a/docs/quick_tutorial/templating/tutorial/home.pt
+++ b/docs/quick_tutorial/templating/tutorial/home.pt
@@ -1,9 +1,9 @@
<!DOCTYPE html>
<html lang="en">
<head>
- <title>Quick Tour: ${name}</title>
+ <title>Quick Tutorial: ${name}</title>
</head>
<body>
<h1>Hi ${name}</h1>
</body>
-</html> \ No newline at end of file
+</html>
diff --git a/docs/quick_tutorial/unit_testing.rst b/docs/quick_tutorial/unit_testing.rst
index f8a33b39d..4cb7ef714 100644
--- a/docs/quick_tutorial/unit_testing.rst
+++ b/docs/quick_tutorial/unit_testing.rst
@@ -24,7 +24,7 @@ and functionality. The Pyramid developers use ``nose``, which we'll thus
use in this tutorial.
Don't worry, this tutorial won't be pedantic about "test-driven
-development" (TDD.) We'll do just enough to ensure that, in each step,
+development" (TDD). We'll do just enough to ensure that, in each step,
we haven't majorly broken the code. As you're writing your code you
might find this more convenient than changing to your browser
constantly and clicking reload.
diff --git a/docs/quick_tutorial/view_classes.rst b/docs/quick_tutorial/view_classes.rst
index 58ab43e40..50a7ee0af 100644
--- a/docs/quick_tutorial/view_classes.rst
+++ b/docs/quick_tutorial/view_classes.rst
@@ -51,7 +51,7 @@ Steps
:linenos:
#. Our unit tests in ``view_classes/tutorial/tests.py`` don't run,
- so let's modify the to import the view class and make an instance
+ so let's modify them to import the view class and make an instance
before getting a response:
.. literalinclude:: view_classes/tutorial/tests.py
@@ -88,7 +88,7 @@ view class, then updated the tests.
In our ``TutorialViews`` view class you can see that our two view
classes are logically grouped together as methods on a common class.
Since the two views shared the same template, we could move that to a
-``@view_defaults`` decorator on at the class level.
+``@view_defaults`` decorator at the class level.
The tests needed to change. Obviously we needed to import the view
class. But you can also see the pattern in the tests of instantiating
diff --git a/docs/quick_tutorial/views.rst b/docs/quick_tutorial/views.rst
index 529bba0a4..6728925fd 100644
--- a/docs/quick_tutorial/views.rst
+++ b/docs/quick_tutorial/views.rst
@@ -92,7 +92,7 @@ module ``views.py`` which is scanned via ``config.scan('.views')``.
We have 2 views, each leading to the other. If you start at
http://localhost:6543/, you get a response with a link to the next
-view. The ``hello_view`` (available at the URL ``/howdy``) has a link
+view. The ``hello`` view (available at the URL ``/howdy``) has a link
back to the first view.
This step also shows that the name appearing in the URL,