docs/conf.py
@@ -185,3 +185,19 @@ # If false, no module index is generated. latex_use_modindex = False ## Say, for a moment that you have a twoside document that needs a 3cm ## inner margin to allow for binding and at least two centimetres the ## rest of the way around. You've been using the a4wide package up until ## now, because you like the amount of text it places on the ## page. Perhaps try something like this in your preamble: ## \usepackage[bindingoffset=1cm,textheight=22cm,hdivide={2cm,*,2cm},vdivide={*,22cm,*}]{geometry} _PREAMBLE = r"""\usepackage[bindingoffset=0.45in,textheight=7.25in,hdivide={0.5in,*,0.75in},vdivide={1in,7.25in,1in},papersize={7.5in,9.25in}]{geometry}""" latex_elements = { 'preamble':_PREAMBLE, # omit for letter size # 'fncychap':r'\usepackage[Sonny]{fncychap}', } docs/glossary.rst
@@ -613,3 +613,6 @@ ``add`` to the normal dictionary interface. See http://pythonpaste.org/webob/class-webob.multidict.MultiDict.html PyPI `The Python Package Index <http://pypi.python.org/pypi>`_, a collection of software available for Python. docs/narr/MyProject/myproject/templates/mytemplate.pt
@@ -7,7 +7,8 @@ <title>${project} Application</title> <meta name="keywords" content="python web application" /> <meta name="description" content="repoze.bfg web application" /> <link href="${request.application_url}/static/default.css" rel="stylesheet" type="text/css" /> <link href="${request.application_url}/static/default.css" rel="stylesheet" type="text/css" /> </head> <body> <!-- start header --> docs/narr/security.rst
@@ -646,12 +646,11 @@ policy which allows the application to use an authorization mechanism that does not involve :term:`ACL` objects. :mod:`repoze.bfg` ships with only its single default :class:`repoze.bfg.authorization.ACLAuthorizationPolicy`, so you'll need to create your own if you'd like to use a different one. Creating and using your own authorization policy is a matter of creating an instance of an object that implements the following interface: :mod:`repoze.bfg` ships with only a single default authorization policy, so you'll need to create your own if you'd like to use a different one. Creating and using your own authorization policy is a matter of creating an instance of an object that implements the following interface: .. code-block:: python docs/narr/templates.rst
@@ -417,15 +417,17 @@ `http://svn.repoze.org/repoze.bfg.xslt <http://svn.repoze.org/repoze.bfg.xslt>`_. :mod:`repoze.bfg.chameleon_genshi` package is an add-on which provides :mod:`repoze.bfg.chameleon_genshi` is an add-on which provides Chameleon Genshi-style template support. It lives in the Repoze Subversion repository at `http://svn.repoze.org/repoze.bfg.chameleon_genshi Subversion repository at `http://svn.repoze.org/repoze.bfg.chameleon_genshi <http://svn.repoze.org/repoze.bfg.chameleon_genshi>`_. Jinja2 template bindings are available for :mod:`repoze.bfg` in the :mod:`repoze.bfg.jinja2` package. It lives in the Repoze Subversion repository at `http://svn.repoze.org/repoze.bfg.jinja2 <http://svn.repoze.org/repoze.bfg.jinja2>`_. <http://svn.repoze.org/repoze.bfg.jinja2>`_; it is also available from :term:`PyPI`. Courtesy of Carlos de la Guardia, bindings for the Zope :mod:`zope.pagetemplate` package ("old TAL") are available from docs/narr/traversal.rst
@@ -161,8 +161,6 @@ How :mod:`repoze.bfg` Processes a Request Using Traversal --------------------------------------------------------- .. image:: modelgraphtraverser.png When a user requests a page from your :mod:`repoze.bfg` -powered application, the system uses this algorithm to determine which Python code to execute: @@ -248,6 +246,8 @@ In either case, the result is returned upstream via the :term:`WSGI` protocol. .. image:: modelgraphtraverser.png .. index:: pair: traversal; example docs/narr/views.rst
@@ -400,8 +400,8 @@ <scan package="."/> - If you are using :term:`imperative configuration`, use the :meth:`repoze.bfg.configuration.Configurator.scan` method: - If you are using :term:`imperative configuration`, use the ``scan`` method of a :class:`repoze.bfg.configuration.Configurator`: .. code-block:: python @@ -1288,8 +1288,7 @@ makes static files available at a name relative to the application root URL, e.g. ``/static``. Use of the imperative configuration method :meth:`repoze.bfg.configuration.configurator.add_static_view` is Use of the ``add_static_view`` imperative configuration method is completely equivalent to using ZCML for the same purpose. Here's an example of a ``static`` ZCML directive that will serve files @@ -1341,8 +1340,8 @@ See :ref:`static_directive` for detailed information. .. note:: The ``<static>`` ZCML directive is new in :mod:`repoze.bfg` 1.1. .. note:: The :ref:`static_directive` ZCML directive is new in :mod:`repoze.bfg` 1.1. .. index:: pair: generating; static resource @@ -1352,9 +1351,10 @@ Generating Static Resource URLs ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ When a ``<static>`` ZCML directive or a call to :meth:`repoze.bfg.configuration.configurator.add_static_view` is used to register a static resource directory, a special helper API named When a ref::`static_directive` ZCML directive or a call to the ``add_static_view`` method of a :class:`repoze.bfg.configuration.Configurator` is used to register a static resource directory, a special helper API named :func:`repoze.bfg.static_url` can be used to generate the appropriate URL for a package resource that lives in one of the directories named by the static registration ``path`` attribute. docs/narr/webob.rst
@@ -261,7 +261,7 @@ .. index:: pair: WebOb; exceptions xceptions Exceptions ++++++++++ To facilitate error responses like 404 Not Found, the module docs/tutorials/bfgwiki/authorization.rst
@@ -23,13 +23,12 @@ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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 @@ .. code-block:: xml :linenos: <span tal:condition="logged_in"><a href="${request.application_url}/logout">Logout</a></span> <span tal:condition="logged_in"> <a href="${request.application_url}/logout">Logout</a> </span> Giving Our Root Model Object an ACL ----------------------------------- docs/tutorials/bfgwiki/basiclayout.rst
@@ -110,7 +110,7 @@ (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 @@ 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. docs/tutorials/bfgwiki/definingmodels.rst
@@ -71,11 +71,10 @@ --------------- 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 @@ 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 ..... ---------------------------------------------------------------------- docs/tutorials/bfgwiki/definingviews.rst
@@ -271,26 +271,25 @@ 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 .. code-block:: text ......... ---------------------------------------------------------------------- Ran 9 tests in 0.203s OK ......... ---------------------------------------------------------------------- Ran 9 tests in 0.203s OK Mapping Views to URLs in ``configure.zcml`` =========================================== @@ -388,27 +387,25 @@ 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/ <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/ <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 <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 <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 <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. docs/tutorials/bfgwiki/distributing.rst
@@ -10,13 +10,13 @@ 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 @@ 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 docs/tutorials/bfgwiki/installation.rst
@@ -51,12 +51,12 @@ #. (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 @@ #. (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 @@ .. 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: docs/tutorials/bfgwiki/src/authorization/tutorial/templates/edit.pt
@@ -6,7 +6,8 @@ <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"/> <title>bfg tutorial wiki (based on TurboGears 20-Minute Wiki) Editing: ${page.__name__}</title> <title>bfg tutorial wiki (based on TurboGears 20-Minute Wiki) Editing: ${page.__name__}</title> <link rel="stylesheet" type="text/css" href="${request.application_url}/static/style.css" /> </head> @@ -17,7 +18,8 @@ <div style="float:right; width: 10em;"> Viewing <span tal:replace="page.__name__">Page Name Goes Here</span> <br/> You can return to the <a href="${request.application_url}">FrontPage</a>. <span tal:condition="logged_in"><a href="${request.application_url}/logout">Logout</a></span> <span tal:condition="logged_in"><a href="${request.application_url}/logout"> Logout</a></span> </div> <div> docs/tutorials/bfgwiki/src/authorization/tutorial/templates/view.pt
@@ -6,7 +6,8 @@ <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"/> <title>${page.__name__} - bfg tutorial wiki (based on TurboGears 20-Minute Wiki)</title> <title>${page.__name__} - bfg tutorial wiki (based on TurboGears 20-Minute Wiki) </title> <link rel="stylesheet" type="text/css" href="${request.application_url}/static/style.css" /> </head> @@ -17,7 +18,9 @@ <div style="float:right; width: 10em;"> Viewing <span tal:replace="page.__name__">Page Name Goes Here</span> <br/> You can return to the <a href="${request.application_url}">FrontPage</a>. <span tal:condition="logged_in"><a href="${request.application_url}/logout">Logout</a></span> <span tal:condition="logged_in"> <a href="${request.application_url}/logout">Logout</a> </span> </div> <div tal:replace="structure content">Page text goes here.</div> docs/tutorials/bfgwiki/src/views/tutorial/templates/edit.pt
@@ -6,7 +6,8 @@ <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"/> <title>bfg tutorial wiki (based on TurboGears 20-Minute Wiki) Editing: ${page.__name__}</title> <title>bfg tutorial wiki (based on TurboGears 20-Minute Wiki) Editing: ${page.__name__}</title> <link rel="stylesheet" type="text/css" href="${request.application_url}/static/style.css" /> </head> docs/tutorials/bfgwiki/src/views/tutorial/templates/view.pt
@@ -6,7 +6,8 @@ <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"/> <title>${page.__name__} - bfg tutorial wiki (based on TurboGears 20-Minute Wiki)</title> <title>${page.__name__} - bfg tutorial wiki (based on TurboGears 20-Minute Wiki) </title> <link rel="stylesheet" type="text/css" href="${request.application_url}/static/style.css" /> </head> docs/tutorials/bfgwiki/viewdecorators.rst
@@ -191,26 +191,26 @@ 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 @@ 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/ <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/ <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 <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 <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. docs/tutorials/bfgwiki2/authorization.rst
@@ -182,7 +182,9 @@ .. code-block:: xml :linenos: <span tal:condition="logged_in"><a href="${request.application_url}/logout">Logout</a></span> <span tal:condition="logged_in"> <a href="${request.application_url}/logout">Logout</a> </span> Viewing the Application in a Browser ------------------------------------ @@ -190,30 +192,26 @@ We can finally examine our application in a browser. The views we'll try are as follows: - Visiting `http://localhost:6543/ <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 <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 <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 <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 ---------------------------------------------------- docs/tutorials/bfgwiki2/basiclayout.rst
@@ -90,9 +90,9 @@ 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. docs/tutorials/bfgwiki2/definingviews.rst
@@ -335,21 +335,18 @@ 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/ <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 <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 <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 <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 @@ 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 docs/tutorials/bfgwiki2/distributing.rst
@@ -10,13 +10,13 @@ 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 @@ 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 docs/tutorials/bfgwiki2/installation.rst
@@ -31,27 +31,27 @@ <http://peak.telecommunity.com/dist/ez_setup.py>`_ 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 @@ #. 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 @@ 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 @@ #. 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ Visit the Application in a Browser ================================== In a browser, visit `http://localhost:6543/ <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 ============================================================= docs/tutorials/bfgwiki2/src/authorization/tutorial/templates/edit.pt
@@ -6,7 +6,8 @@ <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"/> <title>bfg tutorial wiki (based on TurboGears 20-Minute Wiki) Editing: ${page.name}</title> <title>bfg tutorial wiki (based on TurboGears 20-Minute Wiki) Editing: ${page.name}</title> <link rel="stylesheet" type="text/css" href="${request.application_url}/static/style.css" /> </head> @@ -17,7 +18,9 @@ <div style="float:right; width: 10em;"> Viewing <span tal:replace="page.name">Page Name Goes Here</span> <br/> You can return to the <a href="${request.application_url}">FrontPage</a>. <span tal:condition="logged_in"><a href="${request.application_url}/logout">Logout</a></span> <span tal:condition="logged_in"> <a href="${request.application_url}/logout">Logout</a> </span> </div> <div> docs/tutorials/bfgwiki2/src/authorization/tutorial/templates/view.pt
@@ -6,7 +6,8 @@ <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"/> <title>${page.name} - bfg tutorial wiki (based on TurboGears 20-Minute Wiki)</title> <title>${page.name} - bfg tutorial wiki (based on TurboGears 20-Minute Wiki)</title> <link rel="stylesheet" type="text/css" href="${request.application_url}/static/style.css" /> </head> @@ -17,7 +18,9 @@ <div style="float:right; width: 10em;"> Viewing <span tal:replace="page.name">Page Name Goes Here</span> <br/> You can return to the <a href="${request.application_url}">FrontPage</a>. <span tal:condition="logged_in"><a href="${request.application_url}/logout">Logout</a></span> <span tal:condition="logged_in"> <a href="${request.application_url}/logout">Logout</a> </span> </div> <div tal:replace="structure content">Page text goes here.</div> docs/tutorials/bfgwiki2/src/views/tutorial/templates/edit.pt
@@ -6,7 +6,8 @@ <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"/> <title>bfg tutorial wiki (based on TurboGears 20-Minute Wiki) Editing: ${page.name}</title> <title>bfg tutorial wiki (based on TurboGears 20-Minute Wiki) Editing: ${page.name}</title> <link rel="stylesheet" type="text/css" href="${request.application_url}/static/style.css" /> </head> docs/tutorials/gae/index.rst
@@ -26,19 +26,19 @@ #. 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 @@ #. 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 @@ 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 @@ ``config.py`` should remain the same. .. code-block:: python :linenos: APP_NAME = 'bfgapp.run:app' APP_ARGS = ({},) @@ -97,7 +95,6 @@ ``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 @@ ``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 @@ 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 @@ 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 @@ 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 @@ so: .. code-block:: text :linenos: HTTPError: HTTP Error 400: Bad Request Rolling back the update. @@ -196,7 +188,6 @@ 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 @@ 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 docs/tutorials/modwsgi/index.rst
@@ -33,8 +33,7 @@ #. 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 @@ #. 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 @@ #. 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 @@ :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 @@ #. 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 @@ #. 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 @@ 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 @@ #. 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. docs/tutorials/zeo/index.rst
@@ -71,8 +71,7 @@ ``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 @@ 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 @@ When you're finished, your ``.ini`` file might look like so: .. code-block:: ini :linenos: [DEFAULT] debug = true @@ -125,23 +122,25 @@ ``.ini`` files. #. Add a ``zeo.conf`` file to your package with the following contents:: contents: %define INSTANCE . .. code-block:: text <zeo> address $INSTANCE/zeo.sock read-only false invalidation-queue-size 100 pid-filename $INSTANCE/zeo.pid </zeo> %define INSTANCE . <blobstorage 1> <filestorage> path $INSTANCE/myapp.db </filestorage> blob-dir $INSTANCE/blobs </blobstorage> <zeo> address $INSTANCE/zeo.sock read-only false invalidation-queue-size 100 pid-filename $INSTANCE/zeo.pid </zeo> <blobstorage 1> <filestorage> path $INSTANCE/myapp.db </filestorage> blob-dir $INSTANCE/blobs </blobstorage> #. 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 @@ ``models.py`` file to look like the below: .. code-block:: python :linenos: from repoze.folder import Folder @@ -160,7 +158,6 @@ below: .. code-block:: python :linenos: from repoze.bfg.configuration import Configurator from repoze.zodbconn.finder import PersistentApplicationFinder @@ -191,14 +188,13 @@ #. 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 @@ #. 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 @@ 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