diff options
| author | Steve Piercy <web@stevepiercy.com> | 2017-07-03 20:59:01 -0700 |
|---|---|---|
| committer | Steve Piercy <web@stevepiercy.com> | 2017-07-03 20:59:01 -0700 |
| commit | b6937e32be59a214bac5a8097bf5b200eb7b5ac8 (patch) | |
| tree | 6ba72c711ea381fcf33c305cce4294d69f14057f /docs/narr | |
| parent | 0fc3b3aecf7411e2fec59f67d6c5be432bed4f60 (diff) | |
| download | pyramid-b6937e32be59a214bac5a8097bf5b200eb7b5ac8.tar.gz pyramid-b6937e32be59a214bac5a8097bf5b200eb7b5ac8.tar.bz2 pyramid-b6937e32be59a214bac5a8097bf5b200eb7b5ac8.zip | |
Update example apps to use config context manager
Diffstat (limited to 'docs/narr')
| -rw-r--r-- | docs/narr/helloworld.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/docs/narr/helloworld.py b/docs/narr/helloworld.py index c01329af9..29ed8e6f2 100644 --- a/docs/narr/helloworld.py +++ b/docs/narr/helloworld.py @@ -7,10 +7,9 @@ def hello_world(request): return Response('Hello %(name)s!' % request.matchdict) if __name__ == '__main__': - config = Configurator() - config.add_route('hello', '/hello/{name}') - config.add_view(hello_world, route_name='hello') - app = config.make_wsgi_app() + with Configurator() as config: + config.add_route('hello', '/hello/{name}') + config.add_view(hello_world, route_name='hello') + app = config.make_wsgi_app() server = make_server('0.0.0.0', 8080, app) server.serve_forever() - |
