diff options
| author | Patricio Paez <pp@pp.com.mx> | 2012-03-13 15:18:09 -0700 |
|---|---|---|
| committer | Patricio Paez <pp@pp.com.mx> | 2012-03-13 15:18:09 -0700 |
| commit | e5958645c42b18c269f9da627c623fa686b8e336 (patch) | |
| tree | 98f85109ce562c5e846e5c9bc863bcd35459369e /docs | |
| parent | cd475e28d716ad4621b832cf1dc888cfcc4bedce (diff) | |
| download | pyramid-e5958645c42b18c269f9da627c623fa686b8e336.tar.gz pyramid-e5958645c42b18c269f9da627c623fa686b8e336.tar.bz2 pyramid-e5958645c42b18c269f9da627c623fa686b8e336.zip | |
Improved the Authorization chapter
- Highlighted the added lines in the listings
- Simplified 'Viewing the application in a browser' and
added link to Starting the application
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/tutorials/wiki2/authorization.rst | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/docs/tutorials/wiki2/authorization.rst b/docs/tutorials/wiki2/authorization.rst index aadd5097f..b76fd9a6c 100644 --- a/docs/tutorials/wiki2/authorization.rst +++ b/docs/tutorials/wiki2/authorization.rst @@ -118,6 +118,7 @@ your application's ``__init__.py`` will look like this: .. literalinclude:: src/authorization/tutorial/__init__.py :linenos: + :emphasize-lines: 2-3,7,16-18,20-22,25-26 :language: python Adding an authentication policy callback @@ -280,46 +281,56 @@ class="app-welcome align-right">`` div: </span> Seeing Our Changes To ``views.py`` and our Templates ----------------------------------------------------- +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Our ``views.py`` module will look something like this when we're done: .. literalinclude:: src/authorization/tutorial/views.py :linenos: + :emphasize-lines: 11,14-18,56,59,71,74,89-115,117-121 :language: python +(Only the highlighted lines need to be added.) + Our ``edit.pt`` template will look something like this when we're done: .. literalinclude:: src/authorization/tutorial/templates/edit.pt + :emphasize-lines: 41-43 :language: xml +(Only the highlighted lines need to be added.) + Our ``view.pt`` template will look something like this when we're done: .. literalinclude:: src/authorization/tutorial/templates/view.pt + :emphasize-lines: 41-43 :language: xml +(Only the highlighted lines need to be added.) + Viewing the Application in a Browser ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -We can finally examine our application in a browser. The views we'll -try are as follows: +We can finally examine our application in a browser (See +:ref:`wiki2-start-the-application`). Launch a browser and visit +each of the following URLs, check that the result is as expected: -- Visiting ``http://localhost:6543/`` in a browser invokes the +- ``http://localhost:6543/`` invokes the ``view_wiki`` view. This always redirects to the ``view_page`` view of the FrontPage page object. It is executable by any user. -- Visiting ``http://localhost:6543/FrontPage`` in a browser invokes +- ``http://localhost:6543/FrontPage`` invokes the ``view_page`` view of the FrontPage page object. -- Visiting ``http://localhost:6543/FrontPage/edit_page`` in a browser +- ``http://localhost:6543/edit_page/FrontPage`` invokes the edit view for the FrontPage object. It is executable by only the ``editor`` user. If a different user (or the anonymous user) invokes it, a login form will be displayed. Supplying the credentials with the username ``editor``, password ``editor`` will display the edit page form. -- Visiting ``http://localhost:6543/add_page/SomePageName`` in a - browser invokes the add view for a page. It is executable by only +- ``http://localhost:6543/add_page/SomePageName`` + invokes the add view for a page. It is executable by only the ``editor`` user. If a different user (or the anonymous user) invokes it, a login form will be displayed. Supplying the credentials with the username ``editor``, password ``editor`` will |
