summaryrefslogtreecommitdiff
path: root/docs/quick_tour/view_classes
diff options
context:
space:
mode:
authorMichael Merickel <michael@merickel.org>2017-07-12 20:06:48 -0500
committerGitHub <noreply@github.com>2017-07-12 20:06:48 -0500
commitd45f41f7423ef9064b827ef4d4d72bd41fd875f9 (patch)
treeb348ca6562eb1c80ea1baacdc0481ee6e95731b7 /docs/quick_tour/view_classes
parentb8658e94f00962a78e3f8a4c97dd4fbc9e440a31 (diff)
parent0958d268b4b5451c615e05b2b4657d2afb5a7cd4 (diff)
downloadpyramid-d45f41f7423ef9064b827ef4d4d72bd41fd875f9.tar.gz
pyramid-d45f41f7423ef9064b827ef4d4d72bd41fd875f9.tar.bz2
pyramid-d45f41f7423ef9064b827ef4d4d72bd41fd875f9.zip
Merge pull request #3119 from stevepiercy/docs-context-manager
Update docs to use a Configurator context manager
Diffstat (limited to 'docs/quick_tour/view_classes')
-rw-r--r--docs/quick_tour/view_classes/app.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/docs/quick_tour/view_classes/app.py b/docs/quick_tour/view_classes/app.py
index 40faddd00..a007dee14 100644
--- a/docs/quick_tour/view_classes/app.py
+++ b/docs/quick_tour/view_classes/app.py
@@ -2,12 +2,12 @@ from wsgiref.simple_server import make_server
from pyramid.config import Configurator
if __name__ == '__main__':
- config = Configurator()
- config.add_route('hello', '/howdy/{name}')
- config.add_route('hello_json', 'hello.json')
- config.add_static_view(name='static', path='static')
- config.include('pyramid_jinja2')
- config.scan('views')
- app = config.make_wsgi_app()
+ with Configurator() as config:
+ config.add_route('hello', '/howdy/{name}')
+ config.add_route('hello_json', 'hello.json')
+ config.add_static_view(name='static', path='static')
+ config.include('pyramid_jinja2')
+ config.scan('views')
+ app = config.make_wsgi_app()
server = make_server('0.0.0.0', 6543, app)
server.serve_forever()