summaryrefslogtreecommitdiff
path: root/docs/tutorials/wiki
diff options
context:
space:
mode:
Diffstat (limited to 'docs/tutorials/wiki')
-rw-r--r--docs/tutorials/wiki/background.rst4
-rw-r--r--docs/tutorials/wiki/definingmodels.rst6
-rw-r--r--docs/tutorials/wiki/definingviews.rst56
-rw-r--r--docs/tutorials/wiki/distributing.rst16
-rw-r--r--docs/tutorials/wiki/installation.rst72
-rw-r--r--docs/tutorials/wiki/tests.rst10
6 files changed, 82 insertions, 82 deletions
diff --git a/docs/tutorials/wiki/background.rst b/docs/tutorials/wiki/background.rst
index c583b375c..c10ab9e55 100644
--- a/docs/tutorials/wiki/background.rst
+++ b/docs/tutorials/wiki/background.rst
@@ -11,8 +11,8 @@ familiar to someone with :term:`Zope` experience. It uses
URLs to code. It can also be followed by people without any prior
Python web framework experience.
-To code along with this tutorial, the developer will need a UNIX
-machine with development tools (Mac OS X with XCode, any Linux or BSD
+To code along with this tutorial, the developer will need a Unix
+machine with development tools (macOS with XCode, any Linux or BSD
variant, and so on) *or* a Windows system of any kind.
.. warning::
diff --git a/docs/tutorials/wiki/definingmodels.rst b/docs/tutorials/wiki/definingmodels.rst
index 419fede62..e973cfdfe 100644
--- a/docs/tutorials/wiki/definingmodels.rst
+++ b/docs/tutorials/wiki/definingmodels.rst
@@ -43,8 +43,8 @@ Edit ``models.py``
Open ``tutorial/models.py`` file and edit it to look like the following:
.. literalinclude:: src/models/tutorial/models.py
- :linenos:
- :language: python
+ :linenos:
+ :language: python
The first thing we want to do is remove the ``MyModel`` class from the
generated ``models.py`` file. The ``MyModel`` class is only a sample and
@@ -91,6 +91,6 @@ up with a Python traceback on your console that ends with this exception:
.. code-block:: text
- ImportError: cannot import name MyModel
+ ImportError: cannot import name MyModel
This will also happen if you attempt to run the tests.
diff --git a/docs/tutorials/wiki/definingviews.rst b/docs/tutorials/wiki/definingviews.rst
index f4ca9b8d7..e4183b8f2 100644
--- a/docs/tutorials/wiki/definingviews.rst
+++ b/docs/tutorials/wiki/definingviews.rst
@@ -46,9 +46,9 @@ parameter in the ``setup()`` function.
Open ``setup.py`` and edit it to look like the following:
.. literalinclude:: src/views/setup.py
- :linenos:
- :emphasize-lines: 22
- :language: python
+ :linenos:
+ :emphasize-lines: 22
+ :language: python
Only the highlighted line needs to be added.
@@ -64,26 +64,26 @@ the newly added dependency distribution.
Make sure your current working directory is the root of the project (the
directory in which ``setup.py`` lives) and execute the following command.
-On UNIX:
+On Unix:
.. code-block:: bash
- $ cd tutorial
- $ $VENV/bin/pip install -e .
+ cd tutorial
+ $VENV/bin/pip install -e .
On Windows:
.. code-block:: doscon
- c:\> cd tutorial
- c:\tutorial> %VENV%\Scripts\pip install -e .
+ cd tutorial
+ %VENV%\Scripts\pip install -e .
Success executing this command will end with a line to the console something
like:
.. code-block:: text
- Successfully installed docutils-0.13.1 tutorial
+ Successfully installed docutils-0.13.1 tutorial
Adding view functions in ``views.py``
@@ -93,8 +93,8 @@ It's time for a major change. Open ``tutorial/views.py`` and edit it to look
like the following:
.. literalinclude:: src/views/tutorial/views.py
- :linenos:
- :language: python
+ :linenos:
+ :language: python
We added some imports and created a regular expression to find "WikiWords".
@@ -126,9 +126,9 @@ The ``view_wiki`` view function
Following is the code for the ``view_wiki`` view function and its decorator:
.. literalinclude:: src/views/tutorial/views.py
- :lines: 12-14
- :lineno-match:
- :language: python
+ :lines: 12-14
+ :lineno-match:
+ :language: python
.. note:: In our code, we use an *import* that is *relative* to our package
named ``tutorial``, meaning we can omit the name of the package in the
@@ -164,9 +164,9 @@ The ``view_page`` view function
Here is the code for the ``view_page`` view function and its decorator:
.. literalinclude:: src/views/tutorial/views.py
- :lines: 16-33
- :lineno-match:
- :language: python
+ :lines: 16-33
+ :lineno-match:
+ :language: python
The ``view_page`` function is configured to respond as the default view
of a Page resource. We provide it with a ``@view_config`` decorator which
@@ -217,9 +217,9 @@ The ``add_page`` view function
Here is the code for the ``add_page`` view function and its decorator:
.. literalinclude:: src/views/tutorial/views.py
- :lines: 35-50
- :lineno-match:
- :language: python
+ :lines: 35-50
+ :lineno-match:
+ :language: python
The ``add_page`` function is configured to respond when the context resource
is a Wiki and the :term:`view name` is ``add_page``. We provide it with a
@@ -271,9 +271,9 @@ The ``edit_page`` view function
Here is the code for the ``edit_page`` view function and its decorator:
.. literalinclude:: src/views/tutorial/views.py
- :lines: 52-60
- :lineno-match:
- :language: python
+ :lines: 52-60
+ :lineno-match:
+ :language: python
The ``edit_page`` function is configured to respond when the context is
a Page resource and the :term:`view name` is ``edit_page``. We provide it
@@ -316,9 +316,9 @@ The ``view.pt`` template
Rename ``tutorial/templates/mytemplate.pt`` to ``tutorial/templates/view.pt`` and edit the emphasized lines to look like the following:
.. literalinclude:: src/views/tutorial/templates/view.pt
- :linenos:
- :language: html
- :emphasize-lines: 11-12,37-52
+ :linenos:
+ :language: html
+ :emphasize-lines: 11-12,37-52
This template is used by ``view_page()`` for displaying a single
wiki page. It includes:
@@ -335,8 +335,8 @@ The ``edit.pt`` template
Copy ``tutorial/templates/view.pt`` to ``tutorial/templates/edit.pt`` and edit the emphasized lines to look like the following:
.. literalinclude:: src/views/tutorial/templates/edit.pt
- :linenos:
- :language: html
+ :linenos:
+ :language: html
This template is used by ``add_page()`` and ``edit_page()`` for adding and
editing a wiki page. It displays a page containing a form that includes:
diff --git a/docs/tutorials/wiki/distributing.rst b/docs/tutorials/wiki/distributing.rst
index 011a94f51..36d00adb4 100644
--- a/docs/tutorials/wiki/distributing.rst
+++ b/docs/tutorials/wiki/distributing.rst
@@ -9,27 +9,27 @@ using the ``setup.py sdist`` command. The following commands assume your
current working directory contains the ``tutorial`` package and the
``setup.py`` file.
-On UNIX:
+On Unix:
.. code-block:: bash
- $ $VENV/bin/python setup.py sdist
+ $VENV/bin/python setup.py sdist
On Windows:
.. code-block:: doscon
- c:\tutorial> %VENV%\Scripts\python setup.py sdist
+ %VENV%\Scripts\python setup.py sdist
The output of such a command will be something like:
.. code-block:: text
- running sdist
- # more output
- creating dist
- Creating tar archive
- removing 'tutorial-0.0' (and everything under it)
+ running sdist
+ # more output
+ creating dist
+ Creating tar archive
+ removing 'tutorial-0.0' (and everything under it)
Note that this command creates a tarball in the "dist" subdirectory named
``tutorial-0.0.tar.gz``. You can send this file to your friends to show them
diff --git a/docs/tutorials/wiki/installation.rst b/docs/tutorials/wiki/installation.rst
index f87d58b90..71fd0a957 100644
--- a/docs/tutorials/wiki/installation.rst
+++ b/docs/tutorials/wiki/installation.rst
@@ -23,23 +23,23 @@ We will use a :term:`cookiecutter` to create a Python package project from a Pyt
Generate a Pyramid project from a cookiecutter
----------------------------------------------
-We will create a Pyramid project in your home directory for UNIX or at the root for Windows. It is assumed you know the path to where you installed ``cookiecutter``. Issue the following commands and override the defaults in the prompts as follows.
+We will create a Pyramid project in your home directory for Unix or at the root for Windows. It is assumed you know the path to where you installed ``cookiecutter``. Issue the following commands and override the defaults in the prompts as follows.
-On UNIX
+On Unix
^^^^^^^
.. code-block:: bash
- $ cd ~
- $ cookiecutter gh:Pylons/pyramid-cookiecutter-zodb --checkout master
+ cd ~
+ cookiecutter gh:Pylons/pyramid-cookiecutter-zodb --checkout master
On Windows
^^^^^^^^^^
.. code-block:: doscon
- c:\> cd \
- c:\> cookiecutter gh:Pylons/pyramid-cookiecutter-zodb --checkout master
+ cd \
+ cookiecutter gh:Pylons/pyramid-cookiecutter-zodb --checkout master
On all operating systems
^^^^^^^^^^^^^^^^^^^^^^^^
@@ -55,19 +55,19 @@ If prompted for the first item, accept the default ``yes`` by hitting return.
Change directory into your newly created project
------------------------------------------------
-On UNIX
+On Unix
^^^^^^^
.. code-block:: bash
- $ cd tutorial
+ cd tutorial
On Windows
^^^^^^^^^^
.. code-block:: doscon
- c:\> cd tutorial
+ cd tutorial
Set and use a ``VENV`` environment variable
@@ -75,30 +75,30 @@ Set and use a ``VENV`` environment variable
We will set the ``VENV`` environment variable to the absolute path of the virtual environment, and use it going forward.
-On UNIX
+On Unix
^^^^^^^
.. code-block:: bash
- $ export VENV=~/tutorial
+ export VENV=~/tutorial
On Windows
^^^^^^^^^^
.. code-block:: doscon
- c:\tutorial> set VENV=c:\tutorial
+ set VENV=c:\tutorial
Create a virtual environment
----------------------------
-On UNIX
+On Unix
^^^^^^^
.. code-block:: bash
- $ python3 -m venv $VENV
+ python3 -m venv $VENV
On Windows
^^^^^^^^^^
@@ -109,31 +109,31 @@ Python 2.7:
.. code-block:: doscon
- c:\tutorial> c:\Python27\Scripts\virtualenv %VENV%
+ c:\Python27\Scripts\virtualenv %VENV%
Python 3.6:
.. code-block:: doscon
- c:\tutorial> python -m venv %VENV%
+ python -m venv %VENV%
Upgrade packaging tools in the virtual environment
--------------------------------------------------
-On UNIX
+On Unix
^^^^^^^
.. code-block:: bash
- $ $VENV/bin/pip install --upgrade pip setuptools
+ $VENV/bin/pip install --upgrade pip setuptools
On Windows
^^^^^^^^^^
.. code-block:: doscon
- c:\tutorial> %VENV%\Scripts\pip install --upgrade pip setuptools
+ %VENV%\Scripts\pip install --upgrade pip setuptools
.. _installing_project_in_dev_mode_zodb:
@@ -143,19 +143,19 @@ Installing the project in development mode
In order to do development on the project easily, you must "register" the project as a development egg in your workspace. We will install testing requirements at the same time. We do so with the following command.
-On UNIX
+On Unix
^^^^^^^
.. code-block:: bash
- $ $VENV/bin/pip install -e ".[testing]"
+ $VENV/bin/pip install -e ".[testing]"
On Windows
^^^^^^^^^^
.. code-block:: doscon
- c:\tutorial> %VENV%\Scripts\pip install -e ".[testing]"
+ %VENV%\Scripts\pip install -e ".[testing]"
On all operating systems
^^^^^^^^^^^^^^^^^^^^^^^^
@@ -198,26 +198,26 @@ requirements, you may run the tests for the project. The following commands
provide options to py.test that specify the module for which its tests shall be
run, and to run py.test in quiet mode.
-On UNIX
+On Unix
^^^^^^^
.. code-block:: bash
- $ $VENV/bin/py.test -q
+ $VENV/bin/py.test -q
On Windows
^^^^^^^^^^
.. code-block:: doscon
- c:\tutorial> %VENV%\Scripts\py.test -q
+ %VENV%\Scripts\py.test -q
For a successful test run, you should see output that ends like this:
.. code-block:: bash
- .
- 1 passed in 0.24 seconds
+ .
+ 1 passed in 0.24 seconds
Expose test coverage information
@@ -231,19 +231,19 @@ tests.
We've already installed the ``pytest-cov`` package into our virtual
environment, so we can run the tests with coverage.
-On UNIX
+On Unix
^^^^^^^
.. code-block:: bash
- $ $VENV/bin/py.test --cov --cov-report=term-missing
+ $VENV/bin/py.test --cov --cov-report=term-missing
On Windows
^^^^^^^^^^
.. code-block:: doscon
- c:\tutorial> %VENV%\Scripts\py.test --cov --cov-report=term-missing
+ %VENV%\Scripts\py.test --cov --cov-report=term-missing
If successful, you will see output something like this:
@@ -280,19 +280,19 @@ These configuration files are ``pytest.ini`` and ``.coveragerc``, located at
the root of your package. Without these defaults, we would need to specify the
path to the module on which we want to run tests and coverage.
-On UNIX
+On Unix
^^^^^^^
.. code-block:: bash
- $ $VENV/bin/py.test --cov=tutorial tutorial/tests.py -q
+ $VENV/bin/py.test --cov=tutorial tutorial/tests.py -q
On Windows
^^^^^^^^^^
.. code-block:: doscon
- c:\tutorial> %VENV%\Scripts\py.test --cov=tutorial tutorial\tests.py -q
+ %VENV%\Scripts\py.test --cov=tutorial tutorial\tests.py -q
py.test follows :ref:`conventions for Python test discovery
<pytest:test discovery>`, and the configuration defaults from the cookiecutter
@@ -311,19 +311,19 @@ Start the application
Start the application. See :ref:`what_is_this_pserve_thing` for more
information on ``pserve``.
-On UNIX
+On Unix
^^^^^^^
.. code-block:: bash
- $ $VENV/bin/pserve development.ini --reload
+ $VENV/bin/pserve development.ini --reload
On Windows
^^^^^^^^^^
.. code-block:: doscon
- c:\tutorial> %VENV%\Scripts\pserve development.ini --reload
+ %VENV%\Scripts\pserve development.ini --reload
.. note::
diff --git a/docs/tutorials/wiki/tests.rst b/docs/tutorials/wiki/tests.rst
index cd82c0118..c3a1ca79a 100644
--- a/docs/tutorials/wiki/tests.rst
+++ b/docs/tutorials/wiki/tests.rst
@@ -45,8 +45,8 @@ Open the ``tutorial/tests.py`` module, and edit it such that it appears as
follows:
.. literalinclude:: src/tests/tutorial/tests.py
- :linenos:
- :language: python
+ :linenos:
+ :language: python
Running the tests
=================
@@ -56,17 +56,17 @@ We can run these tests by using ``py.test`` similarly to how we did in
already been satisfied and ``py.test`` and coverage have already been
configured, so we can jump right to running tests.
-On UNIX:
+On Unix:
.. code-block:: bash
- $ $VENV/bin/py.test -q
+ $VENV/bin/py.test -q
On Windows:
.. code-block:: doscon
- c:\tutorial> %VENV%\Scripts\py.test -q
+ %VENV%\Scripts\py.test -q
The expected result should look like the following: