docs/conf.py
@@ -13,6 +13,8 @@ import sys, os book = os.environ.get('book') # If your extensions are in another directory, add it here. If the directory # is relative to the documentation root, use os.path.abspath to make it # absolute, like shown here. @@ -83,8 +85,7 @@ #show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' pygments_style = book and 'bw' or 'sphinx' # Options for HTML output # ----------------------- @@ -206,6 +207,7 @@ filecolor=black, urlcolor=black } \fvset{frame=single,xleftmargin=9pt,numbersep=4pt} \pagestyle{fancy} @@ -253,7 +255,7 @@ app.add_directive('mainmatter', mainmatter, 1, (0, 0, 0)) app.add_directive('backmatter', backmatter, 1, (0, 0, 0)) # ugh # strip "repoze.bfg." from all inline literals from sphinx.writers.latex import LaTeXTranslator @@ -275,3 +277,14 @@ LaTeXTranslator.visit_literal = visit_literal # turn off all line numbers in latex formatting ## from pygments.formatters import LatexFormatter ## from sphinx.highlighting import PygmentsBridge ## class NoLinenosLatexFormatter(LatexFormatter): ## def __init__(self, **options): ## LatexFormatter.__init__(self, **options) ## self.linenos = False ## PygmentsBridge.latex_formatter = NoLinenosLatexFormatter docs/narr/MyProject/myproject/templates/mytemplate.pt
@@ -50,8 +50,8 @@ <h2><code>repoze.bfg</code> links</h2> <ul> <li><a href="http://static.repoze.org/bfgdocs/#narrative-documentation">Narrative Documentation</a> href="http://static.repoze.org/bfgdocs/#narrative-documentation" >Narrative Documentation</a> </li> <li> <a @@ -69,13 +69,13 @@ </li> <li> <a href="http://static.repoze.org/bfgdocs/#sample-applications">Sample Applications</a> href="http://static.repoze.org/bfgdocs/#sample-applications" >Sample Applications</a> </li> <li> <a href="http://static.repoze.org/bfgdocs/#support-and-development">Support and Development</a> href="http://static.repoze.org/bfgdocs/#support-and-development" >Support and Development</a> </li> <li> <a docs/narr/environment.rst
@@ -2,8 +2,6 @@ single: environment variables single: settings single: reload single: configure.zcml single: configure_zcml single: debug_authorization single: reload_resources single: debug_notfound @@ -36,53 +34,92 @@ :mod:`repoze.bfg` use. You should not use them to indicate application-specific configuration settings. +---------------------------------+-----------------------------+----------------------------------------+ | Environment Variable Name | Config File Setting Name | Further Information | +=================================+=============================+========================================+ | ``BFG_RELOAD_TEMPLATES`` | ``reload_templates`` | Reload templates without restart | | | | when true | | | | See also: | | | | :ref:`reload_templates_section` | +---------------------------------+-----------------------------+----------------------------------------+ | ``BFG_RELOAD_RESOURCES`` | ``reload_resources`` | Don't cache any resource file data | | | | when true | | | | See also: | | | | :ref:`overriding_resources_section` | +---------------------------------+-----------------------------+----------------------------------------+ | ``BFG_DEBUG_AUTHORIZATION`` | ``debug_authorization`` | Print view authorization failure & | | | | success info to stderr when true | | | | See also: | | | | :ref:`debug_authorization_section` | +---------------------------------+-----------------------------+----------------------------------------+ | ``BFG_DEBUG_NOTFOUND`` | ``debug_notfound`` | Print view-related NotFound debug | | | | messages to stderr when true | | | | See also: | | | | :ref:`debug_notfound_section` | +---------------------------------+-----------------------------+----------------------------------------+ | ``BFG_DEBUG_ALL`` | ``debug_all`` | Turns all debug_* settings on. | +---------------------------------+-----------------------------+----------------------------------------+ | ``BFG_RELOAD_ALL`` | ``reload_all`` | Turns all reload_* settings on. | +---------------------------------+-----------------------------+----------------------------------------+ | ``BFG_CONFIGURE_ZCML`` | ``configure_zcml`` | Use the specified filename to load | | | | the default app :term:`ZCML` file | | | | instead of the filename implied by | | | | ``filename`` value passed to | | | | ``repoze.bfg.router.make_app``. If | | | | this is a relative filename, it will | | | | be considered relative to the | | | | ``package`` passed to ``make_app`` | | | | by the application. It may also | | | | take the form of a :term:`resource | | | | specification` which names both the | | | | package name and a package-relative | | | | filename, e.g. | | | | ``dotted.package.name:path/to.zcml``. | | | | If it is a resource specification, | | | | both the *package* and the | | | | *filename* passed to ``make_app`` | | | | are overridden with the implied | | | | values. | +---------------------------------+-----------------------------+----------------------------------------+ Reloading Templates ~~~~~~~~~~~~~~~~~~~ When this value is true, reload templates without a restart. +---------------------------------+-----------------------------+ | Environment Variable Name | Config File Setting Name | +=================================+=============================+ | ``BFG_RELOAD_TEMPLATES`` | ``reload_templates`` | | | | | | | | | | +---------------------------------+-----------------------------+ Reloading Resources ~~~~~~~~~~~~~~~~~~~ Don't cache any resource file data when this value is true. See also :ref:`overriding_resources_section`. +---------------------------------+-----------------------------+ | Environment Variable Name | Config File Setting Name | +=================================+=============================+ | ``BFG_RELOAD_RESOURCES`` | ``reload_resources`` | | | | | | | | | | +---------------------------------+-----------------------------+ Debugging Authorization ~~~~~~~~~~~~~~~~~~~~~~~ Print view authorization failure and success information to stderr when this value is true. See also :ref:`debug_authorization_section`. +---------------------------------+-----------------------------+ | Environment Variable Name | Config File Setting Name | +=================================+=============================+ | ``BFG_DEBUG_AUTHORIZATION`` | ``debug_authorization`` | | | | | | | | | | +---------------------------------+-----------------------------+ Debugging Not Found Errors ~~~~~~~~~~~~~~~~~~~~~~~~~~ Print view-related ``NotFound`` debug messages to stderr when this value is true. See also :ref:`debug_notfound_section`. +---------------------------------+-----------------------------+ | Environment Variable Name | Config File Setting Name | +=================================+=============================+ | ``BFG_DEBUG_NOTFOUND`` | ``debug_notfound`` | | | | | | | | | | +---------------------------------+-----------------------------+ Debugging All ~~~~~~~~~~~~~ Turns on all ``debug*`` settings. +---------------------------------+-----------------------------+ | Environment Variable Name | Config File Setting Name | +=================================+=============================+ | ``BFG_DEBUG_ALL`` | ``debug_all`` | | | | | | | | | | +---------------------------------+-----------------------------+ Reload All ~~~~~~~~~~ Turns on all ``reload*`` settings. +---------------------------------+-----------------------------+ | Environment Variable Name | Config File Setting Name | +=================================+=============================+ | ``BFG_RELOAD_ALL`` | ``reload_all`` | | | | | | | | | | +---------------------------------+-----------------------------+ Examples -------- @@ -92,7 +129,9 @@ within the file that represents your :mod:`repoze.bfg` application. The configuration file settings documented in the above "Config File Setting Name" column would go in the ``[app:main]`` section. Here's an example of such a section:: an example of such a section: .. code-block:: ini [app:main] use = egg:MyProject#app @@ -101,9 +140,12 @@ You can also use environment variables to accomplish the same purpose for settings documented as such. For example, you might start your :mod:`repoze.bfg` application using the following command line:: :mod:`repoze.bfg` application using the following command line: BFG_DEBUG_AUTHORIZATION=1 BFG_RELOAD_TEMPLATES=1 bin/paster serve MyProject.ini .. code-block:: python $ BFG_DEBUG_AUTHORIZATION=1 BFG_RELOAD_TEMPLATES=1 bin/paster serve \ MyProject.ini If you started your application this way, your :mod:`repoze.bfg` application would behave in the same manner as if you had placed the docs/narr/install.rst
@@ -93,7 +93,8 @@ [chrism@vitaminf ~]$ mkdir opt [chrism@vitaminf ~]$ cd tmp [chrism@vitaminf tmp]$ cd tmp [chrism@vitaminf tmp]$ wget http://python.org/ftp/python/2.5.4/Python-2.5.4.tgz [chrism@vitaminf tmp]$ wget \ http://python.org/ftp/python/2.5.4/Python-2.5.4.tgz [chrism@vitaminf tmp]$ tar xvzf Python-2.5.4.tgz [chrism@vitaminf tmp]$ cd Python-2.5.4 [chrism@vitaminf Python-2.5.4]$ ./configure --prefix=$HOME/opt/Python-2.5.4 docs/narr/unittesting.rst
@@ -231,7 +231,8 @@ def test_view_fn_submitted(self): from my.package import view_fn renderer = self.config.testing_add_template('templates/submitted.pt') renderer = self.config.testing_add_template( 'templates/submitted.pt') request = testing.DummyRequest() request.params['say'] = 'Yo' response = view_fn(request) docs/tutorials/bfgwiki/installation.rst
@@ -51,12 +51,14 @@ #. (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.2" index to get :mod:`repoze.bfg` and its direct dependencies installed: #. Use ``easy_install`` and point to the :mod:`repoze.bfg` "current" index to get :mod:`repoze.bfg` and its direct dependencies installed: .. code-block:: bash $ bin/easy_install -i http://dist.repoze.org/bfg/1.2/simple repoze.bfg $ bin/easy_install -i http://dist.repoze.org/bfg/current/simple \ repoze.bfg #. Use ``easy_install`` to install ``docutils``, ``repoze.tm``, ``repoze.zodbconn``, ``repoze.who``, ``nose`` and ``coverage`` from @@ -104,13 +106,14 @@ #. (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.2" index to get :mod:`repoze.bfg` and its direct dependencies installed: #. Use ``easy_install`` and point to the :mod:`repoze.bfg` "current" 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.2/simple \ repoze.bfg c:\bigfntut> Scripts/easy_install -i \ http://dist.repoze.org/bfg/current/simple repoze.bfg #. Use ``easy_install`` to install ``docutils``, ``repoze.tm``, ``repoze.zodbconn``, ``repoze.who``, ``nose`` and ``coverage`` from @@ -118,7 +121,8 @@ .. code-block:: bat c:\bigfntut> Scripts\easy_install -i http://dist.repoze.org/bfgsite/simple \ c:\bigfntut> Scripts\easy_install -i \ http://dist.repoze.org/bfgsite/simple \ docutils repoze.tm repoze.zodbconn repoze.who nose coverage .. _making_a_project: docs/tutorials/bfgwiki/src/authorization/tutorial/templates/edit.pt
@@ -17,9 +17,10 @@ <div class="main_content"> <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> 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> </div> <div> docs/tutorials/bfgwiki/src/basiclayout/tutorial/run.py
@@ -6,7 +6,8 @@ def app(global_config, **settings): """ This function returns a ``repoze.bfg`` WSGI application. It is usually called by the PasteDeploy framework during ``paster serve``. It is usually called by the PasteDeploy framework during ``paster serve``. """ zodb_uri = settings.get('zodb_uri') if zodb_uri is None: docs/tutorials/bfgwiki/src/views/tutorial/templates/view.pt
@@ -18,7 +18,8 @@ <div class="main_content"> <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>. You can return to the <a href="${request.application_url}">FrontPage</a>. </div> <div tal:replace="structure content">Page text goes here.</div> docs/tutorials/bfgwiki/src/views/tutorial/tests.py
@@ -86,8 +86,9 @@ request.subpath = ['AnotherPage'] info = self._callFUT(context, request) self.assertEqual(info['page'].data,'') self.assertEqual(info['save_url'], model_url(context, request, 'add_page', 'AnotherPage')) self.assertEqual( info['save_url'], model_url(context, request, 'add_page', 'AnotherPage')) def test_it_submitted(self): context = testing.DummyModel() docs/tutorials/bfgwiki2/installation.rst
@@ -56,12 +56,13 @@ #. (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 "current" index to get :mod:`repoze.bfg` and its direct dependencies installed: .. 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/current/simple \ repoze.bfg #. Use ``easy_install`` to install various packages from PyPI. @@ -107,20 +108,21 @@ #. (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 "current" index to get :mod:`repoze.bfg` and its direct dependencies installed: .. 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/current/simple repoze.bfg #. Use ``easy_install`` to install various packages from PyPI. .. code-block:: text c:\bigfntut> Scripts\easy_install -i docutils nose coverage zope.sqlalchemy \ SQLAlchemy repoze.tm2 c:\bigfntut> Scripts\easy_install -i \ http://dist.repoze.org/bfg/current/simple docutils \ nose coverage zope.sqlalchemy SQLAlchemy repoze.tm2 .. _sql_making_a_project: docs/tutorials/bfgwiki2/src/authorization/tutorial/run.py
@@ -17,11 +17,13 @@ def app(global_config, **settings): """ This function returns a repoze.bfg.router.Router object. It is usually called by the PasteDeploy framework during ``paster serve``. It is usually called by the PasteDeploy framework during ``paster serve``. """ db_string = settings.get('db_string') if db_string is None: raise ValueError("No 'db_string' value in application configuration.") raise ValueError( "No 'db_string' value in application configuration.") initialize_sql(db_string) config = Configurator(settings=settings, root_factory=RootFactory) config.begin() docs/tutorials/bfgwiki2/src/authorization/tutorial/templates/edit.pt
@@ -17,7 +17,8 @@ <div class="main_content"> <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>. 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> docs/tutorials/bfgwiki2/src/basiclayout/tutorial/models.py
@@ -15,7 +15,8 @@ from zope.sqlalchemy import ZopeTransactionExtension DBSession = scoped_session(sessionmaker(extension=ZopeTransactionExtension())) DBSession = scoped_session( sessionmaker(extension=ZopeTransactionExtension())) metadata = MetaData() docs/tutorials/bfgwiki2/src/basiclayout/tutorial/run.py
@@ -16,11 +16,13 @@ def app(global_config, **settings): """ This function returns a repoze.bfg.router.Router object. It is usually called by the PasteDeploy framework during ``paster serve``. It is usually called by the PasteDeploy framework during ``paster serve``. """ db_string = settings.get('db_string') if db_string is None: raise ValueError("No 'db_string' value in application configuration.") raise ValueError("No 'db_string' value in application " "configuration.") initialize_sql(db_string) config = Configurator(settings=settings) config.begin() docs/tutorials/bfgwiki2/src/models/tutorial/models.py
@@ -14,7 +14,8 @@ from zope.sqlalchemy import ZopeTransactionExtension DBSession = scoped_session(sessionmaker(extension=ZopeTransactionExtension())) DBSession = scoped_session( sessionmaker(extension=ZopeTransactionExtension())) Base = declarative_base() class Page(Base): docs/tutorials/bfgwiki2/src/views/tutorial/tests.py
@@ -124,7 +124,8 @@ self.session.add(page) info = self._callFUT(request) self.assertEqual(info['page'], page) self.assertEqual(info['save_url'], 'http://example.com/abc/edit_page') self.assertEqual(info['save_url'], 'http://example.com/abc/edit_page') def test_it_submitted(self): from tutorial.models import Page docs/tutorials/bfgwiki2/src/views/tutorial/views.py
@@ -33,7 +33,8 @@ content = publish_parts(page.data, writer_name='html')['html_body'] content = wikiwords.sub(check, content) edit_url = route_url('edit_page', request, pagename=matchdict['pagename']) edit_url = route_url('edit_page', request, pagename=matchdict['pagename']) return dict(page=page, content=content, edit_url=edit_url) def add_page(request): docs/tutorials/modwsgi/index.rst
@@ -54,7 +54,8 @@ .. code-block:: text $ cd ~/projects/modwsgi/env $ bin/easy_install -i http://dist.repoze.org/bfg/current/simple repoze.bfg $ bin/easy_install -i http://dist.repoze.org/bfg/current/simple \ repoze.bfg #. Create and install your :mod:`repoze.bfg` application. For the purposes of this tutorial, we'll just be using the ``bfg_starter``