`` div:
.. code-block:: xml
:linenos:
Logout
Then we need to change each opf our ``view_page``, ``edit_page`` and
``add_page`` views to pass a "logged in" parameter into its template.
We'll add something like this to each view body:
.. code-block:: python
:linenos:
logged_in = 'repoze.who.identity' in request.environ
We'll then change the return value of ``render_template_to_response``
to pass the `resulting `logged_in`` value to the template, e.g.:
.. code-block:: python
:linenos:
return render_template_to_response('templates/view.pt',
request = request,
page = context,
content = content,
logged_in = logged_in,
edit_url = edit_url)
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:
:language: python
Our ``edit.pt`` template will look something like this when we're done:
.. literalinclude:: src/authorization/tutorial/templates/edit.pt
:linenos:
:language: xml
Our ``view.pt`` template will look something like this when we're done:
.. literalinclude:: src/authorization/tutorial/templates/view.pt
:linenos:
:language: xml
Revisiting the Application
---------------------------
When we revisit the application in a browser, and log in (as a result
of hitting an edit or add page and submitting the login form with the
``editor`` credentials), we'll see a Logout link in the upper right
hand corner. When we click it, we're logged out, and redirected back
to the front page.