Skip to content

Commit

Permalink
Updated wiki tutorial docs
Browse files Browse the repository at this point in the history
  • Loading branch information
blaflamme committed Jan 6, 2011
1 parent fda31be commit be3d6f9
Show file tree
Hide file tree
Showing 10 changed files with 83 additions and 92 deletions.
6 changes: 2 additions & 4 deletions docs/tutorials/wiki/authorization.rst
Expand Up @@ -136,7 +136,6 @@ Add a ``login.pt`` template to your templates directory. It's
referred to within the login view we just added to ``login.py``.

.. literalinclude:: src/authorization/tutorial/templates/login.pt
:linenos:
:language: xml

Change ``view.pt`` and ``edit.pt``
Expand All @@ -146,11 +145,10 @@ We'll also need to change our ``edit.pt`` and ``view.pt`` templates to
display a "Logout" link if someone is logged in. This link will
invoke the logout view.

To do so we'll add this to both templates within the ``<div
class="main_content">`` div:
To do so we'll add this to both templates within the ``<div id="right"
class="app-welcome align-right">`` div:

.. code-block:: xml
:linenos:
<span tal:condition="logged_in">
<a href="${request.application_url}/logout">Logout</a>
Expand Down
1 change: 0 additions & 1 deletion docs/tutorials/wiki/basiclayout.rst
Expand Up @@ -169,7 +169,6 @@ The ``development.ini`` (in the tutorial :term:`project` directory, as
opposed to the tutorial :term:`package` directory) looks like this:

.. literalinclude:: src/views/development.ini
:linenos:
:language: ini


Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/wiki/definingmodels.rst
Expand Up @@ -163,7 +163,7 @@ On Windows:

.. code-block:: text
c:\bigfntut\tutorial> ..\Scripts\python setup.py test -q
c:\pyramidtut\tutorial> ..\Scripts\python setup.py test -q
The expected output is something like this:

Expand Down
20 changes: 10 additions & 10 deletions docs/tutorials/wiki/definingviews.rst
Expand Up @@ -230,7 +230,6 @@ Once we're done with the ``view.pt`` template, it will look a lot like
the below:

.. literalinclude:: src/views/tutorial/templates/view.pt
:linenos:
:language: xml

.. note:: The names available for our use in a template are always those that
Expand All @@ -257,23 +256,24 @@ Once we're done with the ``edit.pt`` template, it will look a lot like the
below:

.. literalinclude:: src/views/tutorial/templates/edit.pt
:linenos:
:language: xml

Static Assets
-------------

Our templates name a single static asset named ``style.css``. We need to
create this and place it in a file named ``style.css`` within our package's
``static`` directory. This file is a little too long to replicate within the
body of this guide, however it is available `online
<http://github.com/Pylons/pyramid/blob/master/docs/tutorials/wiki/src/views/tutorial/static/style.css>`_.
Our templates name a single static asset named ``pylons.css``. We don't need
to create this file within our package's ``static`` directory because it was
provided at the time we created the project. This file is a little too long to
replicate within the body of this guide, however it is available `online
<http://github.com/Pylons/pyramid/blob/master/docs/tutorials/wiki/src/views/tutorial/static/pylons.css>`_.

This CSS file will be accessed via
e.g. ``http://localhost:6543/static/style.css`` by virtue of the call to
e.g. ``http://localhost:6543/static/pylons.css`` by virtue of the call to
``add_static_view`` directive we've made in the ``__init__`` file. Any
number and type of static assets can be placed in this directory (or
subdirectories) and are just referred to by URL within templates.
subdirectories) and are just referred to by URL or by using the convenience
method ``static_url`` e.g. ``request.static_url('{{package}}:static/foo.css')``
within templates.

Testing the Views
=================
Expand Down Expand Up @@ -308,7 +308,7 @@ On Windows:

.. code-block:: text
c:\bigfntut\tutorial> ..\Scripts\python setup.py test -q
c:\pyramidtut\tutorial> ..\Scripts\python setup.py test -q
The expected result looks something like:

Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/wiki/distributing.rst
Expand Up @@ -18,7 +18,7 @@ On Windows:

.. code-block:: text
c:\bigfntut> ..\Scripts\python setup.py sdist
c:\pyramidtut> ..\Scripts\python setup.py sdist
.. warning:: If your project files are not checked in to a version
control repository (such as Subversion), the dist tarball will
Expand Down
74 changes: 37 additions & 37 deletions docs/tutorials/wiki/installation.rst
Expand Up @@ -26,43 +26,43 @@ Preparation, UNIX
<http://peak.telecommunity.com/dist/ez_setup.py>`_ and run it using
the ``python`` interpreter of your Python 2.6 installation:

.. code-block:: bash
.. code-block:: text
$ /path/to/my/Python-2.6/bin/python ez_setup.py
#. Use that Python's `bin/easy_install` to install `virtualenv`:

.. code-block:: bash
.. code-block:: text
$ /path/to/my/Python-2.6/bin/easy_install virtualenv
#. Use that Python's virtualenv to make a workspace:

.. code-block:: bash
.. code-block:: text
$ path/to/my/Python-2.6/bin/virtualenv --no-site-packages \
bigfntut
pyramidtut
#. Switch to the ``bigfntut`` directory:
#. Switch to the ``pyramidtut`` directory:

.. code-block:: bash
.. code-block:: text
$ cd bigfntut
$ cd pyramidtut
#. (Optional) Consider using ``source bin/activate`` to make your
shell environment wired to use the virtualenv.

#. Use ``easy_install`` to get :app:`Pyramid` and its direct
dependencies installed:

.. code-block:: bash
.. code-block:: text
$ bin/easy_install pyramid
#. Use ``easy_install`` to install ``docutils``, ``repoze.tm``,
``repoze.zodbconn``, ``nose`` and ``coverage``:

.. code-block:: bash
.. code-block:: text
$ bin/easy_install docutils repoze.tm repoze.zodbconn \
nose coverage
Expand All @@ -79,44 +79,44 @@ Preparation, Windows
the ``python`` interpreter of your Python 2.6 installation using a
command prompt:

.. code-block:: bat
.. code-block:: text
c:\> c:\Python26\python ez_setup.py
#. Use that Python's `bin/easy_install` to install `virtualenv`:

.. code-block:: bat
.. code-block:: text
c:\> c:\Python26\Scripts\easy_install virtualenv
#. Use that Python's virtualenv to make a workspace:

.. code-block:: bat
.. code-block:: text
c:\> c:\Python26\Scripts\virtualenv --no-site-packages bigfntut
c:\> c:\Python26\Scripts\virtualenv --no-site-packages pyramidtut
#. Switch to the ``bigfntut`` directory:
#. Switch to the ``pyramidtut`` directory:

.. code-block:: bat
.. code-block:: text
c:\> cd bigfntut
c:\> cd pyramidtut
#. (Optional) Consider using ``bin\activate.bat`` to make your shell
environment wired to use the virtualenv.

#. Use ``easy_install`` to get :app:`Pyramid` and its direct
dependencies installed:

.. code-block:: bat
.. code-block:: text
c:\bigfntut> Scripts\easy_install pyramid
c:\pyramidtut> Scripts\easy_install pyramid
#. Use ``easy_install`` to install ``docutils``, ``repoze.tm``,
``repoze.zodbconn``, ``nose`` and ``coverage``:

.. code-block:: bat
.. code-block:: text
c:\bigfntut> Scripts\easy_install docutils repoze.tm \
c:\pyramidtut> Scripts\easy_install docutils repoze.tm \
repoze.zodbconn nose coverage
.. _making_a_project:
Expand All @@ -129,19 +129,19 @@ variety of templates to generate sample projects. For this tutorial,
we will use the :term:`ZODB` -oriented template named ``pyramid_zodb``.

The below instructions assume your current working directory is the
"virtualenv" named "bigfntut".
"virtualenv" named "pyramidtut".

On UNIX:

.. code-block:: bash
.. code-block:: text
$ bin/paster create -t pyramid_zodb tutorial
On Windows:

.. code-block:: bat
.. code-block:: text
c:\bigfntut> Scripts\paster create -t pyramid_zodb tutorial
c:\pyramidtut> Scripts\paster create -t pyramid_zodb tutorial
.. note:: If you are using Windows, the ``pyramid_zodb`` Paster template
doesn't currently deal gracefully with installation into a location
Expand All @@ -160,17 +160,17 @@ directory you created in :ref:`making_a_project`, and run the

On UNIX:

.. code-block:: bash
.. code-block:: text
$ cd tutorial
$ ../bin/python setup.py develop
On Windows:

.. code-block:: bat
.. code-block:: text
C:\bigfntut> cd tutorial
C:\bigfntut\tutorial> ..\Scripts\python setup.py develop
C:\pyramidtut> cd tutorial
C:\pyramidtut\tutorial> ..\Scripts\python setup.py develop
.. _running_tests:

Expand All @@ -182,15 +182,15 @@ the tests for the project.

On UNIX:

.. code-block:: bash
.. code-block:: text
$ ../bin/python setup.py test -q
On Windows:

.. code-block:: bat
.. code-block:: text
c:\bigfntut\tutorial> ..\Scripts\python setup.py test -q
c:\pyramidtut\tutorial> ..\Scripts\python setup.py test -q
Starting the Application
========================
Expand All @@ -199,15 +199,15 @@ Start the application.

On UNIX:

.. code-block:: bash
.. code-block:: text
$ ../bin/paster serve development.ini --reload
On Windows:

.. code-block:: bat
.. code-block:: text
c:\bifgfntut\tutorial> ..\Scripts\paster serve development.ini --reload
c:\pyramidtut\tutorial> ..\Scripts\paster serve development.ini --reload
Exposing Test Coverage Information
==================================
Expand All @@ -220,15 +220,15 @@ tests.

On UNIX:

.. code-block:: bash
.. code-block:: text
$ ../bin/nosetests --cover-package=tutorial --cover-erase --with-coverage
On Windows:

.. code-block:: bat
.. code-block:: text
c:\bigfntut\tutorial> ..\Scripts\nosetests --cover-package=tutorial \
c:\pyramidtut\tutorial> ..\Scripts\nosetests --cover-package=tutorial \
--cover-erase --with-coverage
Looks like the code in the ``pyramid_zodb`` template for ZODB projects is
Expand Down
8 changes: 2 additions & 6 deletions docs/tutorials/wiki2/authorization.rst
Expand Up @@ -202,7 +202,6 @@ Add a ``login.pt`` template to your templates directory. It's
referred to within the login view we just added to ``login.py``.

.. literalinclude:: src/authorization/tutorial/templates/login.pt
:linenos:
:language: xml

Change ``view.pt`` and ``edit.pt``
Expand All @@ -212,11 +211,10 @@ We'll also need to change our ``edit.pt`` and ``view.pt`` templates to
display a "Logout" link if someone is logged in. This link will
invoke the logout view.

To do so we'll add this to both templates within the ``<div
class="main_content">`` div:
To do so we'll add this to both templates within the ``<div id="right"
class="app-welcome align-right">`` div:

.. code-block:: xml
:linenos:
<span tal:condition="logged_in">
<a href="${request.application_url}/logout">Logout</a>
Expand Down Expand Up @@ -261,13 +259,11 @@ Our ``views.py`` module will look something like this when we're done:
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
Expand Down
28 changes: 13 additions & 15 deletions docs/tutorials/wiki2/definingviews.rst
Expand Up @@ -212,7 +212,6 @@ Once we're done with the ``view.pt`` template, it will look a lot like
the below:

.. literalinclude:: src/views/tutorial/templates/view.pt
:linenos:
:language: xml

.. note:: The names available for our use in a template are always
Expand Down Expand Up @@ -240,25 +239,24 @@ Once we're done with the ``edit.pt`` template, it will look a lot like
the below:

.. literalinclude:: src/views/tutorial/templates/edit.pt
:linenos:
:language: xml

Static Resources
----------------

Our templates name a single static resource named ``style.css``. We need to
create this and place it in a file named ``style.css`` within our package's
``static`` directory. This file is a little too long to replicate within the
body of this guide, however it is available `online
<http://github.com/Pylons/pyramid/blob/master/docs/tutorials/wiki2/src/views/tutorial/static/style.css>`_.
Static Assets
-------------

Our templates name a single static asset named ``pylons.css``. We don't need
to create this file within our package's ``static`` directory because it was
provided at the time we created the project. This file is a little too long to
replicate within the body of this guide, however it is available `online
<http://github.com/Pylons/pyramid/blob/master/docs/tutorials/wiki2/src/views/tutorial/static/pylons.css>`_.

This CSS file will be accessed via
e.g. ``http://localhost:6543/static/style.css`` by virtue of the call we've
made to :meth:`pyramid.config.Configurator.add_static_view` within our
``__init__.py`` file. Any number and type of static resources can be placed
in this directory (or subdirectories) and are just referred to by URL within
templates.
e.g. ``http://localhost:6543/static/pylons.css`` by virtue of the call to
``add_static_view`` directive we've made in the ``__init__`` file. Any
number and type of static assets can be placed in this directory (or
subdirectories) and are just referred to by URL or by using the convenience
method ``static_url`` e.g. ``request.static_url('{{package}}:static/foo.css')``
within templates.

Mapping Views to URLs in ``__init__.py``
========================================
Expand Down

0 comments on commit be3d6f9

Please sign in to comment.