summaryrefslogtreecommitdiff
path: root/README.rst
diff options
context:
space:
mode:
authorMichael Merickel <michael@merickel.org>2016-12-16 00:48:52 -0600
committerMichael Merickel <michael@merickel.org>2017-04-02 20:08:22 -0500
commit134ef7e8d17842e286528aeb8d2936579ed81053 (patch)
tree7bc97527b0de63ecbd7be01aef3e9b766a714bf4 /README.rst
parentb536bd9db1c435586c476c6d03e3d314979af3ab (diff)
downloadpyramid-134ef7e8d17842e286528aeb8d2936579ed81053.tar.gz
pyramid-134ef7e8d17842e286528aeb8d2936579ed81053.tar.bz2
pyramid-134ef7e8d17842e286528aeb8d2936579ed81053.zip
turn the Configurator into a context manager
fixes #2872
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()