summaryrefslogtreecommitdiff
path: root/docs/narr
diff options
context:
space:
mode:
authorChris McDonough <chrism@agendaless.com>2009-11-27 02:01:45 +0000
committerChris McDonough <chrism@agendaless.com>2009-11-27 02:01:45 +0000
commitbdd2b124c1165fc6fec8c4bd725f0f910b169ecc (patch)
tree09ce4cbcd860f53a6666183362bed35c3bda8850 /docs/narr
parent9d9ffbb5cb587a2bb5481884a264b1527c393265 (diff)
downloadpyramid-bdd2b124c1165fc6fec8c4bd725f0f910b169ecc.tar.gz
pyramid-bdd2b124c1165fc6fec8c4bd725f0f910b169ecc.tar.bz2
pyramid-bdd2b124c1165fc6fec8c4bd725f0f910b169ecc.zip
Get rid of ``zcml_file`` argument in configurator constructor in favor of the load_zcml API.
Get rid of hook_zca argument in configurator constructor in favor of a ``hook_zca`` method. Provide an ``unhook_zca`` method.
Diffstat (limited to 'docs/narr')
-rw-r--r--docs/narr/MyProject/myproject/run.py4
-rw-r--r--docs/narr/configuration.rst24
-rw-r--r--docs/narr/project.rst4
-rw-r--r--docs/narr/scanning.rst6
4 files changed, 21 insertions, 17 deletions
diff --git a/docs/narr/MyProject/myproject/run.py b/docs/narr/MyProject/myproject/run.py
index a9d9973bd..0d7647aa7 100644
--- a/docs/narr/MyProject/myproject/run.py
+++ b/docs/narr/MyProject/myproject/run.py
@@ -5,9 +5,9 @@ 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``"""
+ config = Configurator(root_factory=get_root, settings=settings)
zcml_file = settings.get('configure_zcml', 'configure.zcml')
- config = Configurator(root_factory=get_root, settings=settings,
- zcml_file=zcml_file)
+ config.load_zcml(zcml_file)
return config.make_wsgi_app()
diff --git a/docs/narr/configuration.rst b/docs/narr/configuration.rst
index 6a465db15..c8f29fdfd 100644
--- a/docs/narr/configuration.rst
+++ b/docs/narr/configuration.rst
@@ -587,7 +587,8 @@ In a file named ``helloworld.py``:
return Response('Goodbye world!')
if __name__ == '__main__':
- config = Configurator(zcml_file='configure.zcml')
+ config = Configurator()
+ config.load_zcml('configure.zcml)
app = config.make_wsgi_app()
simple_server.make_server('', 8080, app).serve_forever()
@@ -629,26 +630,27 @@ within the ``if __name__ == '__main__'`` section of ``helloworld.py``:
app = config.make_wsgi_app()
simple_server.make_server('', 8080, app).serve_forever()
-In our "declarative" code, we've added a ``zcml_file`` argument to the
-``Configurator`` constructor's argument list with the value
-``configure.zcml``, and we've removed the lines which read
-``config.add_view(hello_world)`` and ``config.add_view(goodbye_world,
-name='goodbye')``, so that it now reads as:
+In our "declarative" code, we've added a call to the ``load_zcml``
+method of the ``Configurator`` with the value ``configure.zcml``, and
+we've removed the lines which read ``config.add_view(hello_world)``
+and ``config.add_view(goodbye_world, name='goodbye')``, so that it now
+reads as:
.. code-block:: python
:linenos:
if __name__ == '__main__':
- config = Configurator(zcml_file='configure.zcml')
+ config = Configurator()
+ config.load_zcml('configure.zcml')
app = config.make_wsgi_app()
simple_server.make_server('', 8080, app).serve_forever()
Everything else is much the same.
-The ``zcml_file`` argument to the ``Configurator`` constructor tells
-the configurator to load configuration declarations from the
-``configure.zcml`` file which sits next to ``helloworld.py``. Let's
-take a look at the ``configure.zcml`` file now:
+The ``config.load_zcml('configure.zcml')`` line tells the configurator
+to load configuration declarations from the ``configure.zcml`` file
+which sits next to ``helloworld.py``. Let's take a look at the
+``configure.zcml`` file now:
.. code-block:: xml
:linenos:
diff --git a/docs/narr/project.rst b/docs/narr/project.rst
index 80fe6beac..eb0135833 100644
--- a/docs/narr/project.rst
+++ b/docs/narr/project.rst
@@ -539,8 +539,8 @@ The ``myproject`` :term:`package` lives inside the ``MyProject``
comment at the top.
#. A ``configure.zcml`` is a :term:`ZCML` file which maps view names
- to model types. This is also known as the :term:`application
- registry`.
+ to model types. Its contents populate the :term:`application
+ registry` when loaded.
#. A ``models.py`` module, which contains :term:`model` code.
diff --git a/docs/narr/scanning.rst b/docs/narr/scanning.rst
index 084d550d6..477b2144c 100644
--- a/docs/narr/scanning.rst
+++ b/docs/narr/scanning.rst
@@ -123,7 +123,8 @@ of the below examples produces the same application configuration.
if __name__ == '__main__':
from repoze.bfg.configuration import Configurator
- config = Configurator(zcml_file='configure.zcml')
+ config = Configurator()
+ config.load_zcml('configure.zcml')
.. code-block:: xml
:linenos:
@@ -172,7 +173,8 @@ of the below examples produces the same application configuration.
if __name__ == '__main__':
from repoze.bfg.configuration import Configurator
- config = Configurator(zcml_file='configure.zcml')
+ config = Configurator()
+ config.load_zcml('configure.zcml')
.. code-block:: xml
:linenos: