From bdd2b124c1165fc6fec8c4bd725f0f910b169ecc Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Fri, 27 Nov 2009 02:01:45 +0000 Subject: 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. --- docs/narr/configuration.rst | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'docs/narr/configuration.rst') 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: -- cgit v1.2.3