summaryrefslogtreecommitdiff
path: root/docs/narr/declarative.rst
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2010-12-09 02:50:15 -0500
committerChris McDonough <chrism@plope.com>2010-12-09 02:50:15 -0500
commitf360d9e6d9689dfe92a950e97e7e19c414655997 (patch)
treef0456af418ecfaf7d5a342556d2c5786b2aee979 /docs/narr/declarative.rst
parentc18b16d293ee60117747f0de042e2d75361d1fd8 (diff)
parent13173e9e1d1c5f3873e8bfed91e6f3ed561dafaf (diff)
downloadpyramid-f360d9e6d9689dfe92a950e97e7e19c414655997.tar.gz
pyramid-f360d9e6d9689dfe92a950e97e7e19c414655997.tar.bz2
pyramid-f360d9e6d9689dfe92a950e97e7e19c414655997.zip
Merge branch 'twophase'
Conflicts: pyramid/configuration.py
Diffstat (limited to 'docs/narr/declarative.rst')
-rw-r--r--docs/narr/declarative.rst26
1 files changed, 13 insertions, 13 deletions
diff --git a/docs/narr/declarative.rst b/docs/narr/declarative.rst
index eeaed318f..31d6fc575 100644
--- a/docs/narr/declarative.rst
+++ b/docs/narr/declarative.rst
@@ -41,7 +41,7 @@ In a file named ``helloworld.py``:
from paste.httpserver import serve
from pyramid.response import Response
- from pyramid.configuration import Configurator
+ from pyramid.config import Configurator
def hello_world(request):
return Response('Hello world!')
@@ -91,7 +91,7 @@ the ``if __name__ == '__main__'`` section of ``helloworld.py``:
In our "declarative" code, we've removed the call to ``add_view`` and
replaced it with a call to the
-:meth:`pyramid.configuration.Configurator.load_zcml` method so that
+:meth:`pyramid.config.Configurator.load_zcml` method so that
it now reads as:
.. code-block:: python
@@ -135,13 +135,13 @@ This ``<view>`` declaration tag performs the same function as the
``add_view`` method that was employed within
:ref:`imperative_configuration`. In fact, the ``<view>`` tag is
effectively a "macro" which calls the
-:meth:`pyramid.configuration.Configurator.add_view` method on your
+:meth:`pyramid.config.Configurator.add_view` method on your
behalf.
The ``<view>`` tag is an example of a :app:`Pyramid` declaration
tag. Other such tags include ``<route>`` and ``<scan>``. Each of
these tags is effectively a "macro" which calls methods of a
-:class:`pyramid.configuration.Configurator` object on your behalf.
+:class:`pyramid.config.Configurator` object on your behalf.
Essentially, using a :term:`ZCML` file and loading it from the
filesystem allows us to put our configuration statements within this
@@ -212,7 +212,7 @@ To do so, first, create a file named ``helloworld.py``:
.. code-block:: python
:linenos:
- from pyramid.configuration import Configurator
+ from pyramid.config import Configurator
from pyramid.response import Response
from paste.httpserver import serve
@@ -277,7 +277,7 @@ within the ``if __name__ == '__main__'`` section of ``helloworld.py``:
serve(app, host='0.0.0.0')
In our "declarative" code, we've added a call to the
-:meth:`pyramid.configuration.Configurator.load_zcml` method with
+:meth:`pyramid.config.Configurator.load_zcml` method 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:
@@ -433,13 +433,13 @@ configurations imperatively, we saw this code:
config.add_view(goodbye_world, name='goodbye')
Each ``<view>`` declaration tag encountered in a ZCML file effectively
-invokes the :meth:`pyramid.configuration.Configurator.add_view`
+invokes the :meth:`pyramid.config.Configurator.add_view`
method on the behalf of the developer. Various attributes can be
specified on the ``<view>`` tag which influence the :term:`view
configuration` it creates.
Since the relative ordering of calls to
-:meth:`pyramid.configuration.Configurator.add_view` doesn't matter
+:meth:`pyramid.config.Configurator.add_view` doesn't matter
(see the sidebar entitled *View Dispatch and Ordering* within
:ref:`adding_configuration`), the relative order of ``<view>`` tags in
ZCML doesn't matter either. The following ZCML orderings are
@@ -501,7 +501,7 @@ file points to is scanned.
return Response('Hello')
if __name__ == '__main__':
- from pyramid.configuration import Configurator
+ from pyramid.config import Configurator
config = Configurator()
config.begin()
config.load_zcml('configure.zcml')
@@ -645,7 +645,7 @@ Configuring a Route via ZCML
----------------------------
Instead of using the imperative
-:meth:`pyramid.configuration.Configurator.add_route` method to add a new
+:meth:`pyramid.config.Configurator.add_route` method to add a new
route, you can alternately use :term:`ZCML`. :ref:`route_directive`
statements in a :term:`ZCML` file used by your application is a sign that
you're using :term:`URL dispatch`. For example, the following :term:`ZCML
@@ -778,7 +778,7 @@ listening on ``example.com`` must be itself configured to respond properly to
such a request. The :func:`pyramid.url.static_url` API is discussed in more
detail later in this chapter.
-The :meth:`pyramid.configuration.Configurator.add_static_view` method offers
+The :meth:`pyramid.config.Configurator.add_static_view` method offers
an imperative equivalent to the ``static`` ZCML directive. Use of the
``add_static_view`` imperative configuration method is completely equivalent
to using ZCML for the same purpose. See :ref:`static_resources_section` for
@@ -1028,7 +1028,7 @@ with ``.jinja2`` as its ``renderer`` value. The ``name`` passed to the
``renderer=`` to the view configuration.
See also :ref:`renderer_directive` and
-:meth:`pyramid.configuration.Configurator.add_renderer`.
+:meth:`pyramid.config.Configurator.add_renderer`.
Overriding an Existing Renderer
@@ -1097,7 +1097,7 @@ tag):
/>
See also :ref:`renderer_directive` and
-:meth:`pyramid.configuration.Configurator.add_renderer`.
+:meth:`pyramid.config.Configurator.add_renderer`.
.. _zcml_adding_a_translation_directory: