diff options
| author | Blaise Laflamme <blaise@laflamme.org> | 2011-01-06 00:35:40 -0500 |
|---|---|---|
| committer | Blaise Laflamme <blaise@laflamme.org> | 2011-01-06 00:35:40 -0500 |
| commit | be3d6f9b1bc55a5c20b04d36a0724f1ec092d169 (patch) | |
| tree | e7b6e4ccc58f61f267cb770faf61925eec3c48e4 /docs/tutorials/wiki2 | |
| parent | fda31be8f98ac76c69662b2b1dc9afd9caf7f4c1 (diff) | |
| download | pyramid-be3d6f9b1bc55a5c20b04d36a0724f1ec092d169.tar.gz pyramid-be3d6f9b1bc55a5c20b04d36a0724f1ec092d169.tar.bz2 pyramid-be3d6f9b1bc55a5c20b04d36a0724f1ec092d169.zip | |
Updated wiki tutorial docs
Diffstat (limited to 'docs/tutorials/wiki2')
| -rw-r--r-- | docs/tutorials/wiki2/authorization.rst | 8 | ||||
| -rw-r--r-- | docs/tutorials/wiki2/definingviews.rst | 28 | ||||
| -rw-r--r-- | docs/tutorials/wiki2/distributing.rst | 2 | ||||
| -rw-r--r-- | docs/tutorials/wiki2/installation.rst | 32 |
4 files changed, 32 insertions, 38 deletions
diff --git a/docs/tutorials/wiki2/authorization.rst b/docs/tutorials/wiki2/authorization.rst index 8d30ab807..5b07fe788 100644 --- a/docs/tutorials/wiki2/authorization.rst +++ b/docs/tutorials/wiki2/authorization.rst @@ -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`` @@ -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> @@ -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 diff --git a/docs/tutorials/wiki2/definingviews.rst b/docs/tutorials/wiki2/definingviews.rst index e3d611136..d4417ed0b 100644 --- a/docs/tutorials/wiki2/definingviews.rst +++ b/docs/tutorials/wiki2/definingviews.rst @@ -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 @@ -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`` ======================================== diff --git a/docs/tutorials/wiki2/distributing.rst b/docs/tutorials/wiki2/distributing.rst index f4421e145..9f5db19ae 100644 --- a/docs/tutorials/wiki2/distributing.rst +++ b/docs/tutorials/wiki2/distributing.rst @@ -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 diff --git a/docs/tutorials/wiki2/installation.rst b/docs/tutorials/wiki2/installation.rst index e6fd5e6b9..c957f641e 100644 --- a/docs/tutorials/wiki2/installation.rst +++ b/docs/tutorials/wiki2/installation.rst @@ -45,13 +45,13 @@ Preparation, UNIX .. code-block:: text - $ path/to/my/Python-2.6/bin/virtualenv --no-site-packages bigfntut + $ path/to/my/Python-2.6/bin/virtualenv --no-site-packages pyramidtut -#. Switch to the ``bigfntut`` directory: +#. Switch to the ``pyramidtut`` directory: .. code-block:: text - $ cd bigfntut + $ cd pyramidtut #. (Optional) Consider using ``source bin/activate`` to make your shell environment wired to use the virtualenv. @@ -96,13 +96,13 @@ Preparation, Windows .. 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:: text - c:\> cd bigfntut + c:\> cd pyramidtut #. (Optional) Consider using ``bin\activate.bat`` to make your shell environment wired to use the virtualenv. @@ -112,13 +112,13 @@ Preparation, Windows .. code-block:: text - c:\bigfntut> Scripts\easy_install pyramid + c:\pyramidtut> Scripts\easy_install pyramid #. Use ``easy_install`` to install various packages from PyPI. .. code-block:: text - c:\bigfntut> Scripts\easy_install -i docutils \ + c:\pyramidtut> Scripts\easy_install -i docutils \ nose coverage zope.sqlalchemy SQLAlchemy repoze.tm2 @@ -133,7 +133,7 @@ variety of templates to generate sample projects. We will use the that uses :term:`SQLAlchemy` and :term:`URL dispatch`. The below instructions assume your current working directory is the -"virtualenv" named "bigfntut". +"virtualenv" named "pyramidtut". On UNIX: @@ -145,7 +145,7 @@ On Windows: .. code-block:: text - c:\bigfntut> Scripts\paster create -t pyramid_routesalchemy tutorial + c:\pyramidtut> Scripts\paster create -t pyramid_routesalchemy tutorial .. note:: If you are using Windows, the ``pyramid_routesalchemy`` Paster template may not deal gracefully with installation into a @@ -173,8 +173,8 @@ On Windows: .. 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 .. _sql_running_tests: @@ -194,7 +194,7 @@ On Windows: .. code-block:: text - c:\bigfntut\tutorial> ..\Scripts\python setup.py test -q + c:\pyramidtut\tutorial> ..\Scripts\python setup.py test -q Starting the Application ======================== @@ -211,7 +211,7 @@ On Windows: .. 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 ================================== @@ -235,7 +235,7 @@ On Windows: .. code-block:: text - c:\bigfntut\tutorial> ..\Scripts\easy_install nose coverage + c:\pyramidtut\tutorial> ..\Scripts\easy_install nose coverage Once ``nose`` and ``coverage`` are installed, we can actually run the coverage tests. @@ -250,7 +250,7 @@ On Windows: .. 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 our package's ``models`` module doesn't quite have 100% |
