From 125e9746a5da925243dabf67b2609b556bb9215a Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Mon, 28 Dec 2009 04:12:10 +0000 Subject: Adjust for 7.5x9.25in output. --- docs/tutorials/bfgwiki/authorization.rst | 17 +-- docs/tutorials/bfgwiki/basiclayout.rst | 8 +- docs/tutorials/bfgwiki/definingmodels.rst | 17 ++- docs/tutorials/bfgwiki/definingviews.rst | 53 +++++----- docs/tutorials/bfgwiki/distributing.rst | 112 ++++++++++---------- docs/tutorials/bfgwiki/installation.rst | 11 +- .../src/authorization/tutorial/templates/edit.pt | 6 +- .../src/authorization/tutorial/templates/view.pt | 7 +- .../bfgwiki/src/views/tutorial/templates/edit.pt | 3 +- .../bfgwiki/src/views/tutorial/templates/view.pt | 3 +- docs/tutorials/bfgwiki/viewdecorators.rst | 40 ++++---- docs/tutorials/bfgwiki2/authorization.rst | 36 +++---- docs/tutorials/bfgwiki2/basiclayout.rst | 6 +- docs/tutorials/bfgwiki2/definingviews.rst | 27 +++-- docs/tutorials/bfgwiki2/distributing.rst | 114 ++++++++++----------- docs/tutorials/bfgwiki2/installation.rst | 106 ++++++++++--------- .../src/authorization/tutorial/templates/edit.pt | 7 +- .../src/authorization/tutorial/templates/view.pt | 7 +- .../bfgwiki2/src/views/tutorial/templates/edit.pt | 3 +- docs/tutorials/gae/index.rst | 39 +++---- docs/tutorials/modwsgi/index.rst | 27 ++--- docs/tutorials/zeo/index.rst | 48 ++++----- 22 files changed, 342 insertions(+), 355 deletions(-) (limited to 'docs/tutorials') diff --git a/docs/tutorials/bfgwiki/authorization.rst b/docs/tutorials/bfgwiki/authorization.rst index cb0f8439e..52e7cc528 100644 --- a/docs/tutorials/bfgwiki/authorization.rst +++ b/docs/tutorials/bfgwiki/authorization.rst @@ -23,13 +23,12 @@ Changing ``configure.zcml`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~ We'll change our ``configure.zcml`` file to enable an -:class:`repoze.bfg.authentication.AuthTktAuthenticationPolicy` and an -:class:`repoze.bfg.authorization.ACLAuthorizationPolicy` to enable -declarative security checking. We'll also add a ``forbidden`` stanza, -which species a :term:`forbidden view`. This configures our login -view to show up when :mod:`repoze.bfg` detects that a view invocation -can not be authorized. When you're done, your ``configure.zcml`` will -look like so: +``AuthTktAuthenticationPolicy`` and an ``ACLAuthorizationPolicy`` to +enable declarative security checking. We'll also add a ``forbidden`` +stanza, which species a :term:`forbidden view`. This configures our +login view to show up when :mod:`repoze.bfg` detects that a view +invocation can not be authorized. When you're done, your +``configure.zcml`` will look like so: .. literalinclude:: src/authorization/tutorial/configure.zcml :linenos: @@ -123,7 +122,9 @@ class="main_content">`` div: .. code-block:: xml :linenos: - Logout + + Logout + Giving Our Root Model Object an ACL ----------------------------------- diff --git a/docs/tutorials/bfgwiki/basiclayout.rst b/docs/tutorials/bfgwiki/basiclayout.rst index a0fa2b924..f0b7d963c 100644 --- a/docs/tutorials/bfgwiki/basiclayout.rst +++ b/docs/tutorials/bfgwiki/basiclayout.rst @@ -110,7 +110,7 @@ function within the file named ``run.py``: (something like ``file:///path/to/Data.fs``). #. *Line 14*. We create a "finder" object using the - :class:`repoze.zodbconn.finder.PersistentApplicationFinder` helper + ``repoze.zodbconn.finder.PersistentApplicationFinder`` helper class, passing it the ZODB URI and the "appmaker" we've imported from ``models.py``. @@ -121,9 +121,9 @@ function within the file named ``run.py``: factory` and the settings keywords parsed by PasteDeploy. The root factory is named ``get_root``. -#. *Lines 18-20*. Begin configuration using the - :meth:`repoze.bfg.configuration.Configurator.begin` method, load - the ``configure.zcml`` file from our package using the +#. *Lines 18-20*. Begin configuration using the ``begin`` method of + the :meth:`repoze.bfg.configuration.Configurator` class, load the + ``configure.zcml`` file from our package using the :meth:`repoze.bfg.configuration.Configurator.load_zcml` method, and end configuration using the :meth:`repoze.bfg.configuration.Configurator.end` method. diff --git a/docs/tutorials/bfgwiki/definingmodels.rst b/docs/tutorials/bfgwiki/definingmodels.rst index 3c41e9dbe..ef5798362 100644 --- a/docs/tutorials/bfgwiki/definingmodels.rst +++ b/docs/tutorials/bfgwiki/definingmodels.rst @@ -71,11 +71,10 @@ Add an Appmaker --------------- We're using a mini-framework callable named -:class:`repoze.zodbconn.finder.PersistentApplicationFinder` in our -application (see ``run.py``). A -:class:`repoze.zodbconn.finder.PersistentApplicationFinder` accepts a -ZODB URL as well as an "appmaker" callback. This callback typically -lives in the ``models.py`` file. +``repoze.zodbconn.finder.PersistentApplicationFinder`` in our +application (see ``run.py``). A ``PersistentApplicationFinder`` +accepts a ZODB URL as well as an "appmaker" callback. This callback +typically lives in the ``models.py`` file. We want to change the appmaker function in our ``models.py`` file so that our application root is a Wiki instance, and we'll also slot a @@ -120,19 +119,19 @@ directory is the "tutorial" distribution directory: On UNIX: -.. code-block:: bash +.. code-block:: text $ ../bin/python setup.py test -q On Windows: -.. code-block:: bash +.. code-block:: text - c:\bigfntut\tutorial> ..\Scripts\python setup.py test -q + c:\bigfntut\tutorial> ..\Scripts\python setup.py test -q The expected output is something like this: -.. code-block:: bash +.. code-block:: text ..... ---------------------------------------------------------------------- diff --git a/docs/tutorials/bfgwiki/definingviews.rst b/docs/tutorials/bfgwiki/definingviews.rst index bd9c9928c..b8c1ef37b 100644 --- a/docs/tutorials/bfgwiki/definingviews.rst +++ b/docs/tutorials/bfgwiki/definingviews.rst @@ -271,26 +271,25 @@ directory is the "tutorial" distribution directory: On UNIX: -.. code-block:: bash +.. code-block:: text - $ ../bin/python setup.py test -q + $ ../bin/python setup.py test -q On Windows: -.. code-block:: bash +.. code-block:: text - - c:\bigfntut\tutorial> ..\Scripts\python setup.py test -q + c:\bigfntut\tutorial> ..\Scripts\python setup.py test -q The expected result looks something like: -.. code-block:: bash - - ......... - ---------------------------------------------------------------------- - Ran 9 tests in 0.203s +.. code-block:: text - OK + ......... + ---------------------------------------------------------------------- + Ran 9 tests in 0.203s + + OK Mapping Views to URLs in ``configure.zcml`` =========================================== @@ -388,27 +387,25 @@ Viewing the Application in a Browser Once we've set up the WSGI pipeline properly, we can finally examine our application in a browser. The views we'll try are as follows: -- Visiting `http://localhost:6543/ `_ in a - browser invokes the ``view_wiki`` view. This always redirects to - the ``view_page`` view of the FrontPage page object. +- Visiting ``http://localhost:6543/`` in a browser invokes the + ``view_wiki`` view. This always redirects to the ``view_page`` view + of the FrontPage page object. -- Visiting `http://localhost:6543/FrontPage/ - `_ in a browser invokes the - ``view_page`` view of the front page page object. This is because - it's the *default view* (a view without a ``name``) for Page objects. +- Visiting ``http://localhost:6543/FrontPage/`` in a browser invokes + the ``view_page`` view of the front page page object. This is + because it's the *default view* (a view without a ``name``) for Page + objects. -- Visiting `http://localhost:6543/FrontPage/edit_page - `_ in a browser invokes - the edit view for the front page object. +- Visiting ``http://localhost:6543/FrontPage/edit_page`` in a browser + invokes the edit view for the front page object. -- Visiting `http://localhost:6543/add_page/SomePageName - `_ in a browser invokes - the add view for a page. +- Visiting ``http://localhost:6543/add_page/SomePageName`` in a + browser invokes the add view for a page. -- To generate an error, visit `http://localhost:6543/add_page - `_ which will generate an - ``IndexError`` for the expression ``request.subpath[0]``. You'll - see an interactive traceback facility provided by evalerror. +- To generate an error, visit ``http://localhost:6543/add_page`` which + will generate an ``IndexError`` for the expression + ``request.subpath[0]``. You'll see an interactive traceback + facility provided by evalerror. diff --git a/docs/tutorials/bfgwiki/distributing.rst b/docs/tutorials/bfgwiki/distributing.rst index eed08a286..06d126a64 100644 --- a/docs/tutorials/bfgwiki/distributing.rst +++ b/docs/tutorials/bfgwiki/distributing.rst @@ -10,13 +10,13 @@ package is a virtualenv representing a BFG environment. On UNIX: -.. code-block:: bash +.. code-block:: text - $ ../bin/python setup.py sdist + $ ../bin/python setup.py sdist On Windows: -.. code-block:: bat +.. code-block:: text c:\bigfntut> ..\Scripts\python setup.py sdist @@ -29,60 +29,60 @@ On Windows: The output of such a command will be something like: -.. code-block:: bash +.. code-block:: text - running sdist - running egg_info - writing requirements to tutorial.egg-info/requires.txt - writing tutorial.egg-info/PKG-INFO - writing top-level names to tutorial.egg-info/top_level.txt - writing dependency_links to tutorial.egg-info/dependency_links.txt - writing entry points to tutorial.egg-info/entry_points.txt - writing manifest file 'tutorial.egg-info/SOURCES.txt' - warning: sdist: missing required meta-data: url - warning: sdist: missing meta-data: either (author and author_email) or (maintainer and maintainer_email) must be supplied - creating tutorial-0.1 - creating tutorial-0.1/tutorial - creating tutorial-0.1/tutorial.egg-info - creating tutorial-0.1/tutorial/templates - creating tutorial-0.1/tutorial/templates/static - creating tutorial-0.1/tutorial/templates/static/images - making hard links in tutorial-0.1... - hard linking CHANGES.txt -> tutorial-0.1 - hard linking README.txt -> tutorial-0.1 - hard linking setup.cfg -> tutorial-0.1 - hard linking setup.py -> tutorial-0.1 - hard linking tutorial.ini -> tutorial-0.1 - hard linking tutorial/__init__.py -> tutorial-0.1/tutorial - hard linking tutorial/configure.zcml -> tutorial-0.1/tutorial - hard linking tutorial/models.py -> tutorial-0.1/tutorial - hard linking tutorial/run.py -> tutorial-0.1/tutorial - hard linking tutorial/tests.py -> tutorial-0.1/tutorial - hard linking tutorial/views.py -> tutorial-0.1/tutorial - hard linking tutorial.egg-info/PKG-INFO -> tutorial-0.1/tutorial.egg-info - hard linking tutorial.egg-info/SOURCES.txt -> tutorial-0.1/tutorial.egg-info - hard linking tutorial.egg-info/dependency_links.txt -> tutorial-0.1/tutorial.egg-info - hard linking tutorial.egg-info/entry_points.txt -> tutorial-0.1/tutorial.egg-info - hard linking tutorial.egg-info/not-zip-safe -> tutorial-0.1/tutorial.egg-info - hard linking tutorial.egg-info/requires.txt -> tutorial-0.1/tutorial.egg-info - hard linking tutorial.egg-info/top_level.txt -> tutorial-0.1/tutorial.egg-info - hard linking tutorial/templates/edit.pt -> tutorial-0.1/tutorial/templates - hard linking tutorial/templates/mytemplate.pt -> tutorial-0.1/tutorial/templates - hard linking tutorial/templates/view.pt -> tutorial-0.1/tutorial/templates - hard linking tutorial/templates/static/default.css -> tutorial-0.1/tutorial/templates/static - hard linking tutorial/templates/static/style.css -> tutorial-0.1/tutorial/templates/static - hard linking tutorial/templates/static/templatelicense.txt -> tutorial-0.1/tutorial/templates/static - hard linking tutorial/templates/static/images/img01.gif -> tutorial-0.1/tutorial/templates/static/images - hard linking tutorial/templates/static/images/img02.gif -> tutorial-0.1/tutorial/templates/static/images - hard linking tutorial/templates/static/images/img03.gif -> tutorial-0.1/tutorial/templates/static/images - hard linking tutorial/templates/static/images/img04.gif -> tutorial-0.1/tutorial/templates/static/images - hard linking tutorial/templates/static/images/spacer.gif -> tutorial-0.1/tutorial/templates/static/images - copying setup.cfg -> tutorial-0.1 - Writing tutorial-0.1/setup.cfg - creating dist - tar -cf dist/tutorial-0.1.tar tutorial-0.1 - gzip -f9 dist/tutorial-0.1.tar - removing 'tutorial-0.1' (and everything under it) + running sdist + running egg_info + writing requirements to tutorial.egg-info/requires.txt + writing tutorial.egg-info/PKG-INFO + writing top-level names to tutorial.egg-info/top_level.txt + writing dependency_links to tutorial.egg-info/dependency_links.txt + writing entry points to tutorial.egg-info/entry_points.txt + writing manifest file 'tutorial.egg-info/SOURCES.txt' + warning: sdist: missing required meta-data: url + warning: sdist: missing meta-data: either (author and author_email) or (maintainer and maintainer_email) must be supplied + creating tutorial-0.1 + creating tutorial-0.1/tutorial + creating tutorial-0.1/tutorial.egg-info + creating tutorial-0.1/tutorial/templates + creating tutorial-0.1/tutorial/templates/static + creating tutorial-0.1/tutorial/templates/static/images + making hard links in tutorial-0.1... + hard linking CHANGES.txt -> tutorial-0.1 + hard linking README.txt -> tutorial-0.1 + hard linking setup.cfg -> tutorial-0.1 + hard linking setup.py -> tutorial-0.1 + hard linking tutorial.ini -> tutorial-0.1 + hard linking tutorial/__init__.py -> tutorial-0.1/tutorial + hard linking tutorial/configure.zcml -> tutorial-0.1/tutorial + hard linking tutorial/models.py -> tutorial-0.1/tutorial + hard linking tutorial/run.py -> tutorial-0.1/tutorial + hard linking tutorial/tests.py -> tutorial-0.1/tutorial + hard linking tutorial/views.py -> tutorial-0.1/tutorial + hard linking tutorial.egg-info/PKG-INFO -> tutorial-0.1/tutorial.egg-info + hard linking tutorial.egg-info/SOURCES.txt -> tutorial-0.1/tutorial.egg-info + hard linking tutorial.egg-info/dependency_links.txt -> tutorial-0.1/tutorial.egg-info + hard linking tutorial.egg-info/entry_points.txt -> tutorial-0.1/tutorial.egg-info + hard linking tutorial.egg-info/not-zip-safe -> tutorial-0.1/tutorial.egg-info + hard linking tutorial.egg-info/requires.txt -> tutorial-0.1/tutorial.egg-info + hard linking tutorial.egg-info/top_level.txt -> tutorial-0.1/tutorial.egg-info + hard linking tutorial/templates/edit.pt -> tutorial-0.1/tutorial/templates + hard linking tutorial/templates/mytemplate.pt -> tutorial-0.1/tutorial/templates + hard linking tutorial/templates/view.pt -> tutorial-0.1/tutorial/templates + hard linking tutorial/templates/static/default.css -> tutorial-0.1/tutorial/templates/static + hard linking tutorial/templates/static/style.css -> tutorial-0.1/tutorial/templates/static + hard linking tutorial/templates/static/templatelicense.txt -> tutorial-0.1/tutorial/templates/static + hard linking tutorial/templates/static/images/img01.gif -> tutorial-0.1/tutorial/templates/static/images + hard linking tutorial/templates/static/images/img02.gif -> tutorial-0.1/tutorial/templates/static/images + hard linking tutorial/templates/static/images/img03.gif -> tutorial-0.1/tutorial/templates/static/images + hard linking tutorial/templates/static/images/img04.gif -> tutorial-0.1/tutorial/templates/static/images + hard linking tutorial/templates/static/images/spacer.gif -> tutorial-0.1/tutorial/templates/static/images + copying setup.cfg -> tutorial-0.1 + Writing tutorial-0.1/setup.cfg + creating dist + tar -cf dist/tutorial-0.1.tar tutorial-0.1 + gzip -f9 dist/tutorial-0.1.tar + removing 'tutorial-0.1' (and everything under it) Note that this command creates a tarball in the "dist" subdirectory named ``tutorial-0.1.tar.gz``. You can send this file to your friends diff --git a/docs/tutorials/bfgwiki/installation.rst b/docs/tutorials/bfgwiki/installation.rst index 90bd57e31..7955e7c9c 100644 --- a/docs/tutorials/bfgwiki/installation.rst +++ b/docs/tutorials/bfgwiki/installation.rst @@ -51,12 +51,12 @@ Preparation, UNIX #. (Optional) Consider using ``source bin/activate`` to make your shell environment wired to use the virtualenv. -#. Use ``easy_install`` and point to the BFG "1.1" index to get +#. Use ``easy_install`` and point to the BFG "1.2" index to get :mod:`repoze.bfg` and its direct dependencies installed: .. code-block:: bash - $ bin/easy_install -i http://dist.repoze.org/bfg/1.1/simple repoze.bfg + $ bin/easy_install -i http://dist.repoze.org/bfg/1.2/simple repoze.bfg #. Use ``easy_install`` to install ``docutils``, ``repoze.tm``, ``repoze.zodbconn``, ``repoze.who``, ``nose`` and ``coverage`` from @@ -104,12 +104,13 @@ Preparation, Windows #. (Optional) Consider using ``bin\activate.bat`` to make your shell environment wired to use the virtualenv. -#. Use ``easy_install`` and point to the BFG "1,1" index to get +#. Use ``easy_install`` and point to the BFG "1.2" index to get :mod:`repoze.bfg` and its direct dependencies installed: .. code-block:: bat - c:\bigfntut> Scripts/easy_install -i http://dist.repoze.org/bfg/1.1/simple repoze.bfg + c:\bigfntut> Scripts/easy_install -i http://dist.repoze.org/bfg/1.2/simple \ + repoze.bfg #. Use ``easy_install`` to install ``docutils``, ``repoze.tm``, ``repoze.zodbconn``, ``repoze.who``, ``nose`` and ``coverage`` from @@ -118,7 +119,7 @@ Preparation, Windows .. code-block:: bat c:\bigfntut> Scripts\easy_install -i http://dist.repoze.org/bfgsite/simple \ - docutils repoze.tm repoze.zodbconn repoze.who nose coverage + docutils repoze.tm repoze.zodbconn repoze.who nose coverage .. _making_a_project: diff --git a/docs/tutorials/bfgwiki/src/authorization/tutorial/templates/edit.pt b/docs/tutorials/bfgwiki/src/authorization/tutorial/templates/edit.pt index d6b3ad466..abe068352 100644 --- a/docs/tutorials/bfgwiki/src/authorization/tutorial/templates/edit.pt +++ b/docs/tutorials/bfgwiki/src/authorization/tutorial/templates/edit.pt @@ -6,7 +6,8 @@ - bfg tutorial wiki (based on TurboGears 20-Minute Wiki) Editing: ${page.__name__} + bfg tutorial wiki (based on TurboGears 20-Minute Wiki) + Editing: ${page.__name__} @@ -17,7 +18,8 @@
Viewing Page Name Goes Here
You can return to the FrontPage. - Logout + + Logout
diff --git a/docs/tutorials/bfgwiki/src/authorization/tutorial/templates/view.pt b/docs/tutorials/bfgwiki/src/authorization/tutorial/templates/view.pt index 3c5cc2a33..b6105b96f 100644 --- a/docs/tutorials/bfgwiki/src/authorization/tutorial/templates/view.pt +++ b/docs/tutorials/bfgwiki/src/authorization/tutorial/templates/view.pt @@ -6,7 +6,8 @@ - ${page.__name__} - bfg tutorial wiki (based on TurboGears 20-Minute Wiki) + ${page.__name__} - bfg tutorial wiki (based on TurboGears 20-Minute Wiki) + @@ -17,7 +18,9 @@
Viewing Page Name Goes Here
You can return to the FrontPage. -Logout + + Logout +
Page text goes here.
diff --git a/docs/tutorials/bfgwiki/src/views/tutorial/templates/edit.pt b/docs/tutorials/bfgwiki/src/views/tutorial/templates/edit.pt index 883ac8b52..fb4511624 100644 --- a/docs/tutorials/bfgwiki/src/views/tutorial/templates/edit.pt +++ b/docs/tutorials/bfgwiki/src/views/tutorial/templates/edit.pt @@ -6,7 +6,8 @@ - bfg tutorial wiki (based on TurboGears 20-Minute Wiki) Editing: ${page.__name__} + bfg tutorial wiki (based on TurboGears 20-Minute Wiki) + Editing: ${page.__name__} diff --git a/docs/tutorials/bfgwiki/src/views/tutorial/templates/view.pt b/docs/tutorials/bfgwiki/src/views/tutorial/templates/view.pt index 5326e6454..34d097b28 100644 --- a/docs/tutorials/bfgwiki/src/views/tutorial/templates/view.pt +++ b/docs/tutorials/bfgwiki/src/views/tutorial/templates/view.pt @@ -6,7 +6,8 @@ - ${page.__name__} - bfg tutorial wiki (based on TurboGears 20-Minute Wiki) + ${page.__name__} - bfg tutorial wiki (based on TurboGears 20-Minute Wiki) + diff --git a/docs/tutorials/bfgwiki/viewdecorators.rst b/docs/tutorials/bfgwiki/viewdecorators.rst index 265adac4f..8cc220097 100644 --- a/docs/tutorials/bfgwiki/viewdecorators.rst +++ b/docs/tutorials/bfgwiki/viewdecorators.rst @@ -191,26 +191,26 @@ directory is the "tutorial" distribution directory: On UNIX: -.. code-block:: bash +.. code-block:: text - $ ../bin/python setup.py test -q + $ ../bin/python setup.py test -q On Windows: -.. code-block:: bat +.. code-block:: text - c:\bigfntut\tutorial> ..\Scripts\python setup.py test -q + c:\bigfntut\tutorial> ..\Scripts\python setup.py test -q Hopefully nothing will have changed. The expected result looks something like: -.. code-block:: bash +.. code-block:: text - ......... - ---------------------------------------------------------------------- - Ran 9 tests in 0.203s - - OK + ......... + ---------------------------------------------------------------------- + Ran 9 tests in 0.203s + + OK Viewing the Application in a Browser ==================================== @@ -219,22 +219,20 @@ Once we've set up the WSGI pipeline properly, we can finally examine our application in a browser. We'll make sure that we didn't break any views by trying each of them. -- Visiting `http://localhost:6543/ `_ in a +- Visiting ``http://localhost:6543/`` in a browser invokes the ``view_wiki`` view. This always redirects to the ``view_page`` view of the FrontPage page object. -- Visiting `http://localhost:6543/FrontPage/ - `_ in a browser invokes the - ``view_page`` view of the front page page object. This is because - it's the *default view* (a view without a ``name``) for Page objects. +- Visiting ``http://localhost:6543/FrontPage/`` in a browser invokes + the ``view_page`` view of the front page page object. This is + because it's the *default view* (a view without a ``name``) for Page + objects. -- Visiting `http://localhost:6543/FrontPage/edit_page - `_ in a browser invokes - the edit view for the front page object. +- Visiting ``http://localhost:6543/FrontPage/edit_page`` in a browser + invokes the edit view for the front page object. -- Visiting `http://localhost:6543/add_page/SomePageName - `_ in a browser invokes - the add view for a page. +- Visiting ``http://localhost:6543/add_page/SomePageName`` in a + browser invokes the add view for a page. diff --git a/docs/tutorials/bfgwiki2/authorization.rst b/docs/tutorials/bfgwiki2/authorization.rst index df93cb454..3f0aed342 100644 --- a/docs/tutorials/bfgwiki2/authorization.rst +++ b/docs/tutorials/bfgwiki2/authorization.rst @@ -182,7 +182,9 @@ class="main_content">`` div: .. code-block:: xml :linenos: - Logout + + Logout + Viewing the Application in a Browser ------------------------------------ @@ -190,31 +192,27 @@ Viewing the Application in a Browser We can finally examine our application in a browser. The views we'll try are as follows: -- Visiting `http://localhost:6543/ `_ in a - browser invokes the ``view_wiki`` view. This always redirects to - the ``view_page`` view of the FrontPage page object. It is - executable by any user. +- Visiting ``http://localhost:6543/`` in a browser invokes the + ``view_wiki`` view. This always redirects to the ``view_page`` view + of the FrontPage page object. It is executable by any user. -- Visiting `http://localhost:6543/FrontPage - `_ in a browser invokes the - ``view_page`` view of the FrontPage page object. +- Visiting ``http://localhost:6543/FrontPage`` in a browser invokes + the ``view_page`` view of the FrontPage page object. -- Visiting `http://localhost:6543/FrontPage/edit_page - `_ in a browser invokes - the edit view for the FrontPage object. It is executable by only +- Visiting ``http://localhost:6543/FrontPage/edit_page`` in a browser + invokes the edit view for the FrontPage object. It is executable by + only the ``editor`` user. If a different user (or the anonymous + user) invokes it, a login form will be displayed. Supplying the + credentials with the username ``editor``, password ``editor`` will + display the edit page form. + +- Visiting ``http://localhost:6543/add_page/SomePageName`` in a + browser invokes the add view for a page. It is executable by only the ``editor`` user. If a different user (or the anonymous user) invokes it, a login form will be displayed. Supplying the credentials with the username ``editor``, password ``editor`` will display the edit page form. -- Visiting `http://localhost:6543/add_page/SomePageName - `_ in a browser invokes - the add view for a page. It is executable by only the ``editor`` - user. If a different user (or the anonymous user) invokes it, a - login form will be displayed. Supplying the credentials with the - username ``editor``, password ``editor`` will display the edit page - form. - Seeing Our Changes To ``views.py`` and our Templates ---------------------------------------------------- diff --git a/docs/tutorials/bfgwiki2/basiclayout.rst b/docs/tutorials/bfgwiki2/basiclayout.rst index 67e488e9d..d882832d5 100644 --- a/docs/tutorials/bfgwiki2/basiclayout.rst +++ b/docs/tutorials/bfgwiki2/basiclayout.rst @@ -90,9 +90,9 @@ Here is the source for ``models.py``: class. #. *Line 33*. We map our ``models_table`` table to our Models class - here. This makes an association between the ``Model`` class and - the ``models`` table in the database, as far as SQLAlchemy is - concerned. + here. This makes an association between the ``Model`` class and + the ``models`` table in the database, as far as SQLAlchemy is + concerned. #. *Lines 35-40*. A function named ``populate`` which adds a single model instance into our SQL storage and commits a transaction. diff --git a/docs/tutorials/bfgwiki2/definingviews.rst b/docs/tutorials/bfgwiki2/definingviews.rst index 416b431be..79cc519ac 100644 --- a/docs/tutorials/bfgwiki2/definingviews.rst +++ b/docs/tutorials/bfgwiki2/definingviews.rst @@ -335,21 +335,18 @@ Viewing the Application in a Browser Once we've set up the WSGI pipeline properly, we can finally examine our application in a browser. The views we'll try are as follows: -- Visiting `http://localhost:6543/ `_ in a - browser invokes the ``view_wiki`` view. This always redirects to - the ``view_page`` view of the FrontPage page object. +- Visiting ``http://localhost:6543`` in a browser invokes the + ``view_wiki`` view. This always redirects to the ``view_page`` view + of the FrontPage page object. -- Visiting `http://localhost:6543/FrontPage - `_ in a browser invokes the - ``view_page`` view of the front page page object. +- Visiting ``http://localhost:6543/FrontPage`` in a browser invokes + the ``view_page`` view of the front page page object. -- Visiting `http://localhost:6543/FrontPage/edit_page - `_ in a browser invokes - the edit view for the front page object. +- Visiting ``http://localhost:6543/FrontPage/edit_page`` in a browser + invokes the edit view for the front page object. -- Visiting `http://localhost:6543/add_page/SomePageName - `_ in a browser invokes - the add view for a page. +- Visiting ``http://localhost:6543/add_page/SomePageName`` in a + browser invokes the add view for a page. Try generating an error within the body of a view by adding code to the top of it that generates an exception (e.g. ``raise @@ -370,14 +367,14 @@ module to look like this: We can then run the tests using something like: -.. code-block:: bash +.. code-block:: text :linenos: - $ python setup.py test -q + $ python setup.py test -q The expected output is something like: -.. code-block:: bash +.. code-block:: text :linenos: running test diff --git a/docs/tutorials/bfgwiki2/distributing.rst b/docs/tutorials/bfgwiki2/distributing.rst index e03060279..c21cc1417 100644 --- a/docs/tutorials/bfgwiki2/distributing.rst +++ b/docs/tutorials/bfgwiki2/distributing.rst @@ -10,13 +10,13 @@ package is a virtualenv representing a :mod:`repoze.bfg` environment. On UNIX: -.. code-block:: bash +.. code-block:: text - $ ../bin/python setup.py sdist + $ ../bin/python setup.py sdist On Windows: -.. code-block:: bat +.. code-block:: text c:\bigfntut> ..\Scripts\python setup.py sdist @@ -29,61 +29,61 @@ On Windows: The output of such a command will be something like: -.. code-block:: bash +.. code-block:: text - running sdist - running egg_info - writing requirements to tutorial.egg-info/requires.txt - writing tutorial.egg-info/PKG-INFO - writing top-level names to tutorial.egg-info/top_level.txt - writing dependency_links to tutorial.egg-info/dependency_links.txt - writing entry points to tutorial.egg-info/entry_points.txt - writing manifest file 'tutorial.egg-info/SOURCES.txt' - warning: sdist: missing required meta-data: url - warning: sdist: missing meta-data: either (author and author_email) or (maintainer and maintainer_email) must be supplied - creating tutorial-0.1 - creating tutorial-0.1/tutorial - creating tutorial-0.1/tutorial.egg-info - creating tutorial-0.1/tutorial/templates - creating tutorial-0.1/tutorial/templates/static - creating tutorial-0.1/tutorial/templates/static/images - making hard links in tutorial-0.1... - hard linking CHANGES.txt -> tutorial-0.1 - hard linking README.txt -> tutorial-0.1 - hard linking ez_setup.py -> tutorial-0.1 - hard linking setup.cfg -> tutorial-0.1 - hard linking setup.py -> tutorial-0.1 - hard linking tutorial.ini -> tutorial-0.1 - hard linking tutorial/__init__.py -> tutorial-0.1/tutorial - hard linking tutorial/configure.zcml -> tutorial-0.1/tutorial - hard linking tutorial/models.py -> tutorial-0.1/tutorial - hard linking tutorial/run.py -> tutorial-0.1/tutorial - hard linking tutorial/tests.py -> tutorial-0.1/tutorial - hard linking tutorial/views.py -> tutorial-0.1/tutorial - hard linking tutorial.egg-info/PKG-INFO -> tutorial-0.1/tutorial.egg-info - hard linking tutorial.egg-info/SOURCES.txt -> tutorial-0.1/tutorial.egg-info - hard linking tutorial.egg-info/dependency_links.txt -> tutorial-0.1/tutorial.egg-info - hard linking tutorial.egg-info/entry_points.txt -> tutorial-0.1/tutorial.egg-info - hard linking tutorial.egg-info/not-zip-safe -> tutorial-0.1/tutorial.egg-info - hard linking tutorial.egg-info/requires.txt -> tutorial-0.1/tutorial.egg-info - hard linking tutorial.egg-info/top_level.txt -> tutorial-0.1/tutorial.egg-info - hard linking tutorial/templates/edit.pt -> tutorial-0.1/tutorial/templates - hard linking tutorial/templates/mytemplate.pt -> tutorial-0.1/tutorial/templates - hard linking tutorial/templates/view.pt -> tutorial-0.1/tutorial/templates - hard linking tutorial/templates/static/default.css -> tutorial-0.1/tutorial/templates/static - hard linking tutorial/templates/static/style.css -> tutorial-0.1/tutorial/templates/static - hard linking tutorial/templates/static/templatelicense.txt -> tutorial-0.1/tutorial/templates/static - hard linking tutorial/templates/static/images/img01.gif -> tutorial-0.1/tutorial/templates/static/images - hard linking tutorial/templates/static/images/img02.gif -> tutorial-0.1/tutorial/templates/static/images - hard linking tutorial/templates/static/images/img03.gif -> tutorial-0.1/tutorial/templates/static/images - hard linking tutorial/templates/static/images/img04.gif -> tutorial-0.1/tutorial/templates/static/images - hard linking tutorial/templates/static/images/spacer.gif -> tutorial-0.1/tutorial/templates/static/images - copying setup.cfg -> tutorial-0.1 - Writing tutorial-0.1/setup.cfg - creating dist - tar -cf dist/tutorial-0.1.tar tutorial-0.1 - gzip -f9 dist/tutorial-0.1.tar - removing 'tutorial-0.1' (and everything under it) + running sdist + running egg_info + writing requirements to tutorial.egg-info/requires.txt + writing tutorial.egg-info/PKG-INFO + writing top-level names to tutorial.egg-info/top_level.txt + writing dependency_links to tutorial.egg-info/dependency_links.txt + writing entry points to tutorial.egg-info/entry_points.txt + writing manifest file 'tutorial.egg-info/SOURCES.txt' + warning: sdist: missing required meta-data: url + warning: sdist: missing meta-data: either (author and author_email) or (maintainer and maintainer_email) must be supplied + creating tutorial-0.1 + creating tutorial-0.1/tutorial + creating tutorial-0.1/tutorial.egg-info + creating tutorial-0.1/tutorial/templates + creating tutorial-0.1/tutorial/templates/static + creating tutorial-0.1/tutorial/templates/static/images + making hard links in tutorial-0.1... + hard linking CHANGES.txt -> tutorial-0.1 + hard linking README.txt -> tutorial-0.1 + hard linking ez_setup.py -> tutorial-0.1 + hard linking setup.cfg -> tutorial-0.1 + hard linking setup.py -> tutorial-0.1 + hard linking tutorial.ini -> tutorial-0.1 + hard linking tutorial/__init__.py -> tutorial-0.1/tutorial + hard linking tutorial/configure.zcml -> tutorial-0.1/tutorial + hard linking tutorial/models.py -> tutorial-0.1/tutorial + hard linking tutorial/run.py -> tutorial-0.1/tutorial + hard linking tutorial/tests.py -> tutorial-0.1/tutorial + hard linking tutorial/views.py -> tutorial-0.1/tutorial + hard linking tutorial.egg-info/PKG-INFO -> tutorial-0.1/tutorial.egg-info + hard linking tutorial.egg-info/SOURCES.txt -> tutorial-0.1/tutorial.egg-info + hard linking tutorial.egg-info/dependency_links.txt -> tutorial-0.1/tutorial.egg-info + hard linking tutorial.egg-info/entry_points.txt -> tutorial-0.1/tutorial.egg-info + hard linking tutorial.egg-info/not-zip-safe -> tutorial-0.1/tutorial.egg-info + hard linking tutorial.egg-info/requires.txt -> tutorial-0.1/tutorial.egg-info + hard linking tutorial.egg-info/top_level.txt -> tutorial-0.1/tutorial.egg-info + hard linking tutorial/templates/edit.pt -> tutorial-0.1/tutorial/templates + hard linking tutorial/templates/mytemplate.pt -> tutorial-0.1/tutorial/templates + hard linking tutorial/templates/view.pt -> tutorial-0.1/tutorial/templates + hard linking tutorial/templates/static/default.css -> tutorial-0.1/tutorial/templates/static + hard linking tutorial/templates/static/style.css -> tutorial-0.1/tutorial/templates/static + hard linking tutorial/templates/static/templatelicense.txt -> tutorial-0.1/tutorial/templates/static + hard linking tutorial/templates/static/images/img01.gif -> tutorial-0.1/tutorial/templates/static/images + hard linking tutorial/templates/static/images/img02.gif -> tutorial-0.1/tutorial/templates/static/images + hard linking tutorial/templates/static/images/img03.gif -> tutorial-0.1/tutorial/templates/static/images + hard linking tutorial/templates/static/images/img04.gif -> tutorial-0.1/tutorial/templates/static/images + hard linking tutorial/templates/static/images/spacer.gif -> tutorial-0.1/tutorial/templates/static/images + copying setup.cfg -> tutorial-0.1 + Writing tutorial-0.1/setup.cfg + creating dist + tar -cf dist/tutorial-0.1.tar tutorial-0.1 + gzip -f9 dist/tutorial-0.1.tar + removing 'tutorial-0.1' (and everything under it) Note that this command creates a tarball in the "dist" subdirectory named ``tutorial-0.1.tar.gz``. You can send this file to your friends diff --git a/docs/tutorials/bfgwiki2/installation.rst b/docs/tutorials/bfgwiki2/installation.rst index 22fc6b563..ad5443288 100644 --- a/docs/tutorials/bfgwiki2/installation.rst +++ b/docs/tutorials/bfgwiki2/installation.rst @@ -31,27 +31,27 @@ Preparation, UNIX `_ and run it using the ``python`` interpreter of your Python 2.5 installation: - .. code-block:: bash + .. code-block:: text - $ /path/to/my/Python-2.5/bin/python ez_setup.py + $ /path/to/my/Python-2.5/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.5/bin/easy_install virtualenv + $ /path/to/my/Python-2.5/bin/easy_install virtualenv #. Use that Python's virtualenv to make a workspace: - .. code-block:: bash + .. code-block:: text - $ path/to/my/Python-25/bin/virtualenv --no-site-packages bigfntut + $ path/to/my/Python-25/bin/virtualenv --no-site-packages bigfntut #. Switch to the ``bigfntut`` directory: - .. code-block:: bash + .. code-block:: text - $ cd bigfntut + $ cd bigfntut #. (Optional) Consider using ``source bin/activate`` to make your shell environment wired to use the virtualenv. @@ -59,15 +59,16 @@ Preparation, UNIX #. Use ``easy_install`` and point to the BFG "1.1" index to get :mod:`repoze.bfg` and its direct dependencies installed: - .. code-block:: bash + .. code-block:: text - $ bin/easy_install -i http://dist.repoze.org/bfg/1.1/simple repoze.bfg + $ bin/easy_install -i http://dist.repoze.org/bfg/1.1/simple repoze.bfg #. Use ``easy_install`` to install various packages from PyPI. - .. code-block:: bash + .. code-block:: text - $ bin/easy_install docutils nose coverage zope.sqlalchemy SQLAlchemy repoze.tm2 + $ bin/easy_install docutils nose coverage zope.sqlalchemy SQLAlchemy \ + repoze.tm2 Preparation, Windows -------------------- @@ -81,27 +82,27 @@ Preparation, Windows the ``python`` interpreter of your Python 2.5 installation using a command prompt: - .. code-block:: bat + .. code-block:: text - c:\> c:\Python25\python ez_setup.py + c:\> c:\Python25\python ez_setup.py #. Use that Python's `bin/easy_install` to install `virtualenv`: - .. code-block:: bat + .. code-block:: text - c:\> c:\Python25\Scripts\easy_install virtualenv + c:\> c:\Python25\Scripts\easy_install virtualenv #. Use that Python's virtualenv to make a workspace: - .. code-block:: bat + .. code-block:: text - c:\> c:\Python25\Scripts\virtualenv --no-site-packages bigfntut + c:\> c:\Python25\Scripts\virtualenv --no-site-packages bigfntut #. Switch to the ``bigfntut`` directory: - .. code-block:: bat + .. code-block:: text - c:\> cd bigfntut + c:\> cd bigfntut #. (Optional) Consider using ``bin\activate.bat`` to make your shell environment wired to use the virtualenv. @@ -109,15 +110,17 @@ Preparation, Windows #. Use ``easy_install`` and point to the BFG "1.1" index to get :mod:`repoze.bfg` and its direct dependencies installed: - .. code-block:: bat + .. code-block:: text - c:\bigfntut> Scripts/easy_install -i http://dist.repoze.org/bfg/1.1/simple repoze.bfg + c:\bigfntut> Scripts/easy_install -i http://dist.repoze.org/bfg/1.1/simple \ + repoze.bfg #. Use ``easy_install`` to install various packages from PyPI. - .. code-block:: bat + .. code-block:: text - c:\bigfntut> Scripts\easy_install -i docutils nose coverage zope.sqlalchemy SQLAlchemy repoze.tm2 + c:\bigfntut> Scripts\easy_install -i docutils nose coverage zope.sqlalchemy \ + SQLAlchemy repoze.tm2 .. _sql_making_a_project: @@ -135,13 +138,13 @@ The below instructions assume your current working directory is the On UNIX: -.. code-block:: bash +.. code-block:: text - $ bin/paster create -t bfg_routesalchemy tutorial + $ bin/paster create -t bfg_routesalchemy tutorial On Windows: -.. code-block:: bat +.. code-block:: text c:\bigfntut> Scripts\paster create -t bfg_routesalchemy tutorial @@ -162,17 +165,17 @@ directory you created in :ref:`sql_making_a_project`, and run the On UNIX: -.. code-block:: bash +.. code-block:: text - $ cd tutorial - $ ../bin/python setup.py develop + $ 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:\bigfntut> cd tutorial + c:\bigfntut\tutorial> ..\Scripts\python setup.py develop .. _sql_running_tests: @@ -184,15 +187,15 @@ the tests for the project. On UNIX: -.. code-block:: bash +.. code-block:: text - $ ../bin/python setup.py test -q + $ ../bin/python setup.py test -q On Windows: -.. code-block:: bat +.. code-block:: text - c:\bigfntut\tutorial> ..\Scripts\python setup.py test -q + c:\bigfntut\tutorial> ..\Scripts\python setup.py test -q Starting the Application ======================== @@ -201,15 +204,15 @@ Start the application. On UNIX: -.. code-block:: bash +.. code-block:: text - $ ../bin/paster serve tutorial.ini --reload + $ ../bin/paster serve tutorial.ini --reload On Windows: -.. code-block:: bat +.. code-block:: text - c:\bifgfntut\tutorial> ..\Scripts\paster serve tutorial.ini --reload + c:\bifgfntut\tutorial> ..\Scripts\paster serve tutorial.ini --reload Exposing Test Coverage Information ================================== @@ -225,30 +228,31 @@ other packages into our ``virtualenv``: ``nose`` and ``coverage``: On UNIX: -.. code-block:: bash +.. code-block:: text - $ ../bin/easy_install nose coverage + $ ../bin/easy_install nose coverage On Windows: -.. code-block:: bat +.. code-block:: text - c:\bfgfntut\tutorial> ..\Scripts\easy_install nose coverage + c:\bfgfntut\tutorial> ..\Scripts\easy_install nose coverage Once ``nose`` and ``coverage`` are installed, we can actually run the coverage tests. On UNIX: -.. code-block:: bash +.. code-block:: text - $ ../bin/nosetests --cover-package=tutorial --cover-erase --with-coverage + $ ../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 --cover-erase --with-coverage + c:\bigfntut\tutorial> ..\Scripts\nosetests --cover-package=tutorial --cover-erase \ + --with-coverage Looks like our package's ``models`` module doesn't quite have 100% test coverage. @@ -256,8 +260,8 @@ test coverage. Visit the Application in a Browser ================================== -In a browser, visit `http://localhost:6543/ `_. -You will see the generated application's default page. +In a browser, visit ``http://localhost:6543/``. You will see the +generated application's default page. Decisions the ``bfg_routesalchemy`` Template Has Made For You ============================================================= diff --git a/docs/tutorials/bfgwiki2/src/authorization/tutorial/templates/edit.pt b/docs/tutorials/bfgwiki2/src/authorization/tutorial/templates/edit.pt index 5e56f1fd6..2482d8ca5 100644 --- a/docs/tutorials/bfgwiki2/src/authorization/tutorial/templates/edit.pt +++ b/docs/tutorials/bfgwiki2/src/authorization/tutorial/templates/edit.pt @@ -6,7 +6,8 @@ - bfg tutorial wiki (based on TurboGears 20-Minute Wiki) Editing: ${page.name} + bfg tutorial wiki (based on TurboGears 20-Minute Wiki) + Editing: ${page.name} @@ -17,7 +18,9 @@
Viewing Page Name Goes Here
You can return to the FrontPage. - Logout + + Logout +
diff --git a/docs/tutorials/bfgwiki2/src/authorization/tutorial/templates/view.pt b/docs/tutorials/bfgwiki2/src/authorization/tutorial/templates/view.pt index 59c21d4eb..6c066f557 100644 --- a/docs/tutorials/bfgwiki2/src/authorization/tutorial/templates/view.pt +++ b/docs/tutorials/bfgwiki2/src/authorization/tutorial/templates/view.pt @@ -6,7 +6,8 @@ - ${page.name} - bfg tutorial wiki (based on TurboGears 20-Minute Wiki) + ${page.name} - bfg tutorial wiki + (based on TurboGears 20-Minute Wiki) @@ -17,7 +18,9 @@
Viewing Page Name Goes Here
You can return to the FrontPage. -Logout + + Logout +
Page text goes here.
diff --git a/docs/tutorials/bfgwiki2/src/views/tutorial/templates/edit.pt b/docs/tutorials/bfgwiki2/src/views/tutorial/templates/edit.pt index 3d9e960c2..6a98e3cfb 100644 --- a/docs/tutorials/bfgwiki2/src/views/tutorial/templates/edit.pt +++ b/docs/tutorials/bfgwiki2/src/views/tutorial/templates/edit.pt @@ -6,7 +6,8 @@ - bfg tutorial wiki (based on TurboGears 20-Minute Wiki) Editing: ${page.name} + bfg tutorial wiki (based on TurboGears 20-Minute Wiki) + Editing: ${page.name} diff --git a/docs/tutorials/gae/index.rst b/docs/tutorials/gae/index.rst index 8d7f89311..cf78896bb 100644 --- a/docs/tutorials/gae/index.rst +++ b/docs/tutorials/gae/index.rst @@ -26,19 +26,19 @@ system. #. Use Subversion to check out the source code for ``appengine-monkey``. - .. code-block:: bash - :linenos: + .. code-block:: text - $ svn co http://appengine-monkey.googlecode.com/svn/trunk/ appengine-monkey + $ svn co http://appengine-monkey.googlecode.com/svn/trunk/ \ + appengine-monkey #. Use ``appengine_homedir.py`` script in ``appengine-monkey`` to create a :term:`virtualenv` for your application. - .. code-block:: bash - :linenos: + .. code-block:: text $ export GAE_PATH=/usr/local/google_appengine - $ python2.5 /path/to/appengine-monkey/appengine-homedir.py --gae $GAE_PATH bfgapp + $ python2.5 /path/to/appengine-monkey/appengine-homedir.py --gae \ + $GAE_PATH bfgapp Note that ``$GAE_PATH`` should be the path where you have unpacked the App Engine SDK. (On Mac OS X at least, @@ -52,11 +52,11 @@ system. #. Install :mod:`repoze.bfg.jinja2` into the virtualenv - .. code-block:: bash - :linenos: + .. code-block:: text $ cd bfgapp/ - $ bin/easy_install -i http://dist.repoze.org/bfg/current/simple/ repoze.bfg.jinja2 + $ bin/easy_install -i http://dist.repoze.org/bfg/current/simple/ \ + repoze.bfg.jinja2 This will install :mod:`repoze.bfg` in the environment. @@ -68,8 +68,7 @@ system. the ``bfgapp`` virtualenv director you created in the third step above: - .. code-block:: bash - :linenos: + .. code-block:: text $ cd app $ rm -rf bfgapp @@ -86,7 +85,6 @@ system. ``config.py`` should remain the same. .. code-block:: python - :linenos: APP_NAME = 'bfgapp.run:app' APP_ARGS = ({},) @@ -97,7 +95,6 @@ system. ``import site`` in app/runner.py: .. code-block:: python - :linenos: import sys sys.path = [path for path in sys.path if 'site-packages' not in path] @@ -107,7 +104,6 @@ system. ``assert sys.path`` in the file. .. code-block:: python - :linenos: # comment the sys.path assertion out # assert sys.path[:len(cur_sys_path)] == cur_sys_path, ( @@ -118,7 +114,7 @@ system. with Python 2.5 (or whatever version of Python your GAE SDK expects). - .. code-block:: bash + .. code-block:: text :linenos: $ cd ../.. @@ -127,7 +123,6 @@ system. Startup success looks something like this: .. code-block:: text - :linenos: [chrism@vitaminf bfg_gae]$ python2.5 /usr/local/bin/dev_appserver.py bfgapp/app/INFO 2009-05-03 22:23:13,887 appengine_rpc.py:157] Server: appengine.google.com INFO 2009-05-03 22:23:13,898 appcfg.py:320] Checking for updates to the SDK. @@ -165,14 +160,12 @@ system. name you created during GAE account setup. .. code-block:: yaml - :linenos: application: mycoolbfgapp #. Upload the application - .. code-block:: bash - :linenos: + .. code-block:: text $ python2.5 /usr/local/bin/appcfg.py update bfgapp/app @@ -181,7 +174,6 @@ system. so: .. code-block:: text - :linenos: HTTPError: HTTP Error 400: Bad Request Rolling back the update. @@ -196,7 +188,6 @@ system. A successful upload looks like so: .. code-block:: text - :linenos: [chrism@vitaminf bfgapp]$ python2.5 /usr/local/bin/appcfg.py update ../bfgapp/app/ Scanning files on local disk. @@ -240,16 +231,14 @@ application's virtualenv. First, see which packages are available for zipping: -.. code-block:: bash - :linenos: +.. code-block:: text $ bin/pip zip -l This shows your zipped packages (by default, none) and your unzipped packages. You can zip a package like so: -.. code-block:: bash - :linenos: +.. code-block:: text $ bin/pip zip pytz-2009g-py2.5.egg diff --git a/docs/tutorials/modwsgi/index.rst b/docs/tutorials/modwsgi/index.rst index 01f3058ff..6f6ccbb45 100644 --- a/docs/tutorials/modwsgi/index.rst +++ b/docs/tutorials/modwsgi/index.rst @@ -33,8 +33,7 @@ commands and files. #. Install :term:`virtualenv` into the Python which mod_wsgi will run using the ``easy_install`` program. - .. code-block:: bash - :linenos: + .. code-block:: text $ sudo /usr/bin/easy_install-2.6 virtualenv @@ -43,8 +42,7 @@ commands and files. #. Create a :term:`virtualenv` which we'll use to install our application. - .. code-block:: bash - :linenos: + .. code-block:: text $ cd ~ $ mkdir -p /projects/modwsgi @@ -53,8 +51,7 @@ commands and files. #. Install :mod:`repoze.bfg` into the newly created virtualenv: - .. code-block:: bash - :linenos: + .. code-block:: text $ cd ~/projects/modwsgi/env $ bin/easy_install -i http://dist.repoze.org/bfg/current/simple repoze.bfg @@ -65,8 +62,7 @@ commands and files. :mod:`repoze.bfg` application as necessary if you already have one. - .. code-block:: bash - :linenos: + .. code-block:: text $ cd ~/projects/modwsgi/env $ bin/paster create -t bfg_starter myapp @@ -76,11 +72,11 @@ commands and files. #. Within the virtualenv directory (``~/projects/modwsgi/env``), create a script named ``bfg.wsgi``. Give it these contents: - .. code-block:: bash - :linenos: + .. code-block:: python from repoze.bfg.paster import get_app - application = get_app('/Users/chrism/projects/modwsgi/env/myapp/myapp.ini', 'main') + application = get_app( + '/Users/chrism/projects/modwsgi/env/myapp/myapp.ini', 'main') The first argument to ``get_app`` is the project Paste configuration file name. The second is the name of the section @@ -90,8 +86,7 @@ commands and files. #. Make the ``bfg.wsgi`` script executable. - .. code-block:: bash - :linenos: + .. code-block:: text $ cd ~/projects/modwsgi/env $ chmod 755 bfg.wsgi @@ -101,7 +96,6 @@ commands and files. system while installing Apache, so this stuff went in there. .. code-block:: apache - :linenos: # Use only 1 Python sub-interpreter. Multiple sub-interpreters # play badly with C extensions. @@ -119,10 +113,9 @@ commands and files. #. Restart Apache - .. code-block:: bash - :linenos: + .. code-block:: text - $ sudo /usr/sbin/apachectl restart + $ sudo /usr/sbin/apachectl restart #. Visit ``http://localhost/myapp`` in a browser. You should see the sample application rendered in your browser. diff --git a/docs/tutorials/zeo/index.rst b/docs/tutorials/zeo/index.rst index 145bdf4f5..70dbdd6e0 100644 --- a/docs/tutorials/zeo/index.rst +++ b/docs/tutorials/zeo/index.rst @@ -71,8 +71,7 @@ Configuration ``main``, rename this section to ``myapp`` (e.g. ``app:main`` -> ``app:myapp``). Add a key to it named ``zodb_uri``, e.g. - .. code-block:: python - :linenos: + .. code-block:: ini [app:myapp] use = egg:myapp#app @@ -86,8 +85,7 @@ Configuration Put the names ``connector``, ``egg:repoze.retry#retry``, and ``egg:repoze.tm2#tm`` to the top of the pipeline. - .. code-block:: python - :linenos: + .. code-block:: ini [pipeline:main] pipeline = @@ -98,7 +96,6 @@ Configuration When you're finished, your ``.ini`` file might look like so: .. code-block:: ini - :linenos: [DEFAULT] debug = true @@ -125,23 +122,25 @@ Configuration ``.ini`` files. #. Add a ``zeo.conf`` file to your package with the following - contents:: + contents: + + .. code-block:: text - %define INSTANCE . + %define INSTANCE . - - address $INSTANCE/zeo.sock - read-only false - invalidation-queue-size 100 - pid-filename $INSTANCE/zeo.pid - + + address $INSTANCE/zeo.sock + read-only false + invalidation-queue-size 100 + pid-filename $INSTANCE/zeo.pid + - - - path $INSTANCE/myapp.db - - blob-dir $INSTANCE/blobs - + + + path $INSTANCE/myapp.db + + blob-dir $INSTANCE/blobs + #. For the purposes of this tutorial we'll assume that you want your :mod:`repoze.bfg` application's :term:`root` object to be a @@ -149,7 +148,6 @@ Configuration ``models.py`` file to look like the below: .. code-block:: python - :linenos: from repoze.folder import Folder @@ -160,7 +158,6 @@ Configuration below: .. code-block:: python - :linenos: from repoze.bfg.configuration import Configurator from repoze.zodbconn.finder import PersistentApplicationFinder @@ -191,14 +188,13 @@ Running #. Start the ZEO server in a terminal with the current directory set to the package directory: - .. code-block:: bash - :linenos: + .. code-block:: text ../bin/runzeo -C zeo.conf You should see something like this, as a result: - .. code-block:: bash + .. code-block:: text :linenos: [chrism@snowpro myapp]$ ../bin/runzeo -C zeo.conf @@ -215,7 +211,7 @@ Running #. While the ZEO server is running, start the application server: - .. code-block:: python + .. code-block:: text :linenos: [chrism@snowpro myapp]$ ../bin/paster serve myapp.ini @@ -229,7 +225,7 @@ Running application's HTTP server is running) by using the ``bfgshell`` command in a third terminal window: - .. code-block:: bash + .. code-block:: text :linenos: [chrism@snowpro sess]$ ../bin/paster --plugin=repoze.bfg bfgshell myapp.ini myapp -- cgit v1.2.3