summaryrefslogtreecommitdiff
path: root/README.rst
diff options
context:
space:
mode:
authorMichael Merickel <michael@merickel.org>2017-04-29 21:46:20 -0500
committerGitHub <noreply@github.com>2017-04-29 21:46:20 -0500
commit1086143ba3aed46f057e11a2c5808d8cd75248d0 (patch)
tree76664e6c818d9479e4c6aa97e99d5e493094f1c9 /README.rst
parentc4ccb619de65b1353e73352c884344c06f49973d (diff)
parent134ef7e8d17842e286528aeb8d2936579ed81053 (diff)
downloadpyramid-1086143ba3aed46f057e11a2c5808d8cd75248d0.tar.gz
pyramid-1086143ba3aed46f057e11a2c5808d8cd75248d0.tar.bz2
pyramid-1086143ba3aed46f057e11a2c5808d8cd75248d0.zip
Merge pull request #2874 from mmerickel/config-context-manager
turn the Configurator into a context manager
Diffstat (limited to 'README.rst')
-rw-r--r--README.rst8
1 files changed, 4 insertions, 4 deletions
diff --git a/README.rst b/README.rst
index f05dd8bbf..302590fe1 100644
--- a/README.rst
+++ b/README.rst
@@ -31,10 +31,10 @@ and deployment more fun, more predictable, and more productive.
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()