Skip to content

Commit

Permalink
Clean up code-blocks in qt/static_assets
Browse files Browse the repository at this point in the history
  • Loading branch information
stevepiercy committed Aug 18, 2018
1 parent 1d0533b commit 482cc91
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions docs/quick_tutorial/static_assets.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,46 +23,46 @@ Steps

.. code-block:: bash
$ cd ..; cp -r view_classes static_assets; cd static_assets
$ $VENV/bin/pip install -e .
cd ..; cp -r view_classes static_assets; cd static_assets
$VENV/bin/pip install -e .
#. We add a call ``config.add_static_view`` in
``static_assets/tutorial/__init__.py``:

.. literalinclude:: static_assets/tutorial/__init__.py
:linenos:
:linenos:

#. We can add a CSS link in the ``<head>`` of our template at
``static_assets/tutorial/home.pt``:

.. literalinclude:: static_assets/tutorial/home.pt
:language: html
:language: html

#. Add a CSS file at ``static_assets/tutorial/static/app.css``:

.. literalinclude:: static_assets/tutorial/static/app.css
:language: css
:language: css

#. We add a functional test that asserts that the newly added static file is delivered:

.. literalinclude:: static_assets/tutorial/tests.py
:language: python
:pyobject: TutorialFunctionalTests.test_css
:lineno-match:
:language: python
:pyobject: TutorialFunctionalTests.test_css
:lineno-match:

#. Now run the tests:

.. code-block:: bash
$ $VENV/bin/py.test tutorial/tests.py -q
....
5 passed in 0.50 seconds
$VENV/bin/py.test tutorial/tests.py -q
....
5 passed in 0.50 seconds
#. Run your Pyramid application with:

.. code-block:: bash
$ $VENV/bin/pserve development.ini --reload
$VENV/bin/pserve development.ini --reload
#. Open http://localhost:6543/ in your browser and note the new font.

Expand All @@ -82,7 +82,7 @@ disk? Pyramid gives a helper that provides flexibility on URL generation:

.. code-block:: html

${request.static_url('tutorial:static/app.css')}
${request.static_url('tutorial:static/app.css')}

This matches the ``path='tutorial:static'`` in our ``config.add_static_view``
registration. By using ``request.static_url`` to generate the full URL to the
Expand Down

0 comments on commit 482cc91

Please sign in to comment.