diff options
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/narr/MyProject/myproject/configure.zcml | 1 | ||||
| -rw-r--r-- | docs/narr/MyProject/myproject/run.py | 12 | ||||
| -rw-r--r-- | docs/narr/configuration.rst | 3 | ||||
| -rw-r--r-- | docs/narr/project.rst | 11 |
4 files changed, 15 insertions, 12 deletions
diff --git a/docs/narr/MyProject/myproject/configure.zcml b/docs/narr/MyProject/myproject/configure.zcml index 038f04da4..fe9633fe1 100644 --- a/docs/narr/MyProject/myproject/configure.zcml +++ b/docs/narr/MyProject/myproject/configure.zcml @@ -1,6 +1,5 @@ <configure xmlns="http://namespaces.repoze.org/bfg"> - <!-- this must be included for the view declarations to work --> <include package="repoze.bfg.includes" /> <view diff --git a/docs/narr/MyProject/myproject/run.py b/docs/narr/MyProject/myproject/run.py index 65cd6dfe6..a9d9973bd 100644 --- a/docs/narr/MyProject/myproject/run.py +++ b/docs/narr/MyProject/myproject/run.py @@ -1,11 +1,13 @@ -from repoze.bfg.router import make_app +from repoze.bfg.configuration import Configurator +from myproject.models import get_root 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``""" - # paster app config callback - from myproject.models import get_root - import myproject - return make_app(get_root, myproject, settings=settings) + zcml_file = settings.get('configure_zcml', 'configure.zcml') + config = Configurator(root_factory=get_root, settings=settings, + zcml_file=zcml_file) + return config.make_wsgi_app() + diff --git a/docs/narr/configuration.rst b/docs/narr/configuration.rst index c4f502031..6be8daa73 100644 --- a/docs/narr/configuration.rst +++ b/docs/narr/configuration.rst @@ -347,8 +347,7 @@ In a file named ``helloworld.py``: return Response('Hello world!') if __name__ == '__main__': - config = Configurator() - config.load_zcml() + config = Configurator(zcml_file='configure.zcml') app = config.make_wsgi_app() simple_server.make_server('', 8080, app).serve_forever() diff --git a/docs/narr/project.rst b/docs/narr/project.rst index 776f6f9a8..80fe6beac 100644 --- a/docs/narr/project.rst +++ b/docs/narr/project.rst @@ -692,11 +692,14 @@ without the PasteDeploy configuration file: .. literalinclude:: MyProject/myproject/run.py :linenos: -#. Line 1 imports the ``make_app`` functions from - :mod:`repoze.bfg.router` that we use later. +#. Line 1 imports the ``Configurator`` class from + :mod:`repoze.bfg.configuration` that we use later. -#. Lines 3-10 define a function that returns a :mod:`repoze.bfg` Router - application from :ref:`router_module` . This is meant to be called +#. Line 2 imports the ``get_root`` function from + :mod:`myproject.models` that we use later. + +#. Lines 4-11 define a function that returns a :mod:`repoze.bfg` + WSGI application. This function is meant to be called by the :term:`PasteDeploy` framework as a result of running ``paster serve``. |
