diff options
| author | Kirk Strauser <kirk@strauser.com> | 2011-04-20 13:34:51 -0500 |
|---|---|---|
| committer | Kirk Strauser <kirk@strauser.com> | 2011-04-20 13:34:51 -0500 |
| commit | 89346583ec29dcc5d973cc807ae9899cf81b06ef (patch) | |
| tree | 869e08a66f1c2414f50ad913a7cfd83bad98e646 /docs/tutorials/wiki2 | |
| parent | bea9f5b1b99fc27ee2a79512d098d688aea9d113 (diff) | |
| download | pyramid-89346583ec29dcc5d973cc807ae9899cf81b06ef.tar.gz pyramid-89346583ec29dcc5d973cc807ae9899cf81b06ef.tar.bz2 pyramid-89346583ec29dcc5d973cc807ae9899cf81b06ef.zip | |
Fixed typos and added clarifications in a tutorial
I was working through the wiki2 tutorial this morning and found some
slightly confusing bits. As I went along, I added the suggested changes
to my local files to make them match the tutorial's version, but found
several times that key parts were missing.
I'm not new to Python so this didn't slow me down, but thought some
clarifications might help new users.
Diffstat (limited to 'docs/tutorials/wiki2')
| -rw-r--r-- | docs/tutorials/wiki2/authorization.rst | 18 | ||||
| -rw-r--r-- | docs/tutorials/wiki2/basiclayout.rst | 2 | ||||
| -rw-r--r-- | docs/tutorials/wiki2/definingmodels.rst | 8 |
3 files changed, 25 insertions, 3 deletions
diff --git a/docs/tutorials/wiki2/authorization.rst b/docs/tutorials/wiki2/authorization.rst index 64cab30db..aa0e03599 100644 --- a/docs/tutorials/wiki2/authorization.rst +++ b/docs/tutorials/wiki2/authorization.rst @@ -76,7 +76,14 @@ For any :app:`Pyramid` application to perform authorization, we need to add a We'll change our ``__init__.py`` file to enable an ``AuthTktAuthenticationPolicy`` and an ``ACLAuthorizationPolicy`` to enable -declarative security checking. +declarative security checking. We need to import the new policies: + +.. literalinclude:: src/authorization/tutorial/__init__.py + :lines: 2-3,8 + :linenos: + :language: python + +Then, we'll add those policies to the configuration: .. literalinclude:: src/authorization/tutorial/__init__.py :lines: 15-21 @@ -97,13 +104,20 @@ We'll also change ``__init__.py``, adding a call to :term:`view callable`. This is also known as a :term:`forbidden view`: .. literalinclude:: src/authorization/tutorial/__init__.py - :lines: 24-26 + :lines: 24-26,40-42 :linenos: :language: python A forbidden view configures our newly created login view to show up when :app:`Pyramid` detects that a view invocation can not be authorized. +A ``logout`` :term:`view callable` will allow users to log out later: + +.. literalinclude:: src/authorization/tutorial/__init__.py + :lines: 27-28 + :linenos: + :language: python + We'll also add ``view_permission`` arguments with the value ``edit`` to the ``edit_page`` and ``add_page`` routes. This indicates that the view callables which these routes reference cannot be invoked without the diff --git a/docs/tutorials/wiki2/basiclayout.rst b/docs/tutorials/wiki2/basiclayout.rst index 0dbcf6684..9bd65e8b8 100644 --- a/docs/tutorials/wiki2/basiclayout.rst +++ b/docs/tutorials/wiki2/basiclayout.rst @@ -98,7 +98,7 @@ names a ``view_renderer``, which is a template which lives in the ``tutorial.views.my_view`` view returns a dictionary, a :term:`renderer` will use this template to create a response. -Fimnally, we use the :meth:`pyramid.config.Configurator.make_wsgi_app` +Finally, we use the :meth:`pyramid.config.Configurator.make_wsgi_app` method to return a :term:`WSGI` application: .. literalinclude:: src/basiclayout/tutorial/__init__.py diff --git a/docs/tutorials/wiki2/definingmodels.rst b/docs/tutorials/wiki2/definingmodels.rst index 1661753c1..e5d283125 100644 --- a/docs/tutorials/wiki2/definingmodels.rst +++ b/docs/tutorials/wiki2/definingmodels.rst @@ -26,6 +26,14 @@ The first thing we want to do is remove the stock ``MyModel`` class from the generated ``models.py`` file. The ``MyModel`` class is only a sample and we're not going to use it. +Next, we'll remove the :class:`sqlalchemy.Unicode` import and replace it +with :class:`sqlalchemy.Text`. + +.. literalinclude:: src/models/tutorial/models.py + :lines: 5 + :linenos: + :language: py + Then, we'll add a ``Page`` class. Because this is a SQLAlchemy application, this class should inherit from an instance of :class:`sqlalchemy.ext.declarative.declarative_base`. Declarative |
