diff options
| author | Chris McDonough <chrism@agendaless.com> | 2009-11-27 02:01:45 +0000 |
|---|---|---|
| committer | Chris McDonough <chrism@agendaless.com> | 2009-11-27 02:01:45 +0000 |
| commit | bdd2b124c1165fc6fec8c4bd725f0f910b169ecc (patch) | |
| tree | 09ce4cbcd860f53a6666183362bed35c3bda8850 /docs/narr/configuration.rst | |
| parent | 9d9ffbb5cb587a2bb5481884a264b1527c393265 (diff) | |
| download | pyramid-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/configuration.rst')
| -rw-r--r-- | docs/narr/configuration.rst | 24 |
1 files changed, 13 insertions, 11 deletions
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: |
