summaryrefslogtreecommitdiff
path: root/docs/quick_tutorial
diff options
context:
space:
mode:
Diffstat (limited to 'docs/quick_tutorial')
-rw-r--r--docs/quick_tutorial/hello_world.rst2
-rw-r--r--docs/quick_tutorial/hello_world/app.py8
-rw-r--r--docs/quick_tutorial/package/tutorial/app.py12
3 files changed, 11 insertions, 11 deletions
diff --git a/docs/quick_tutorial/hello_world.rst b/docs/quick_tutorial/hello_world.rst
index 2f2515fcd..94242f1f4 100644
--- a/docs/quick_tutorial/hello_world.rst
+++ b/docs/quick_tutorial/hello_world.rst
@@ -75,7 +75,7 @@ explanation:
"Start here when running from the command line", rather than when this
module is imported.
-#. *Lines 12-14*. Use Pyramid's :term:`configurator` to connect :term:`view`
+#. *Lines 12-14*. Use Pyramid's :term:`configurator` in a :term:`context manager` to connect :term:`view`
code to a particular URL :term:`route`.
#. *Lines 6-8*. Implement the view code that generates the :term:`response`.
diff --git a/docs/quick_tutorial/hello_world/app.py b/docs/quick_tutorial/hello_world/app.py
index 0a95f9ad3..d0351e251 100644
--- a/docs/quick_tutorial/hello_world/app.py
+++ b/docs/quick_tutorial/hello_world/app.py
@@ -9,9 +9,9 @@ def hello_world(request):
if __name__ == '__main__':
- config = Configurator()
- config.add_route('hello', '/')
- config.add_view(hello_world, route_name='hello')
- app = config.make_wsgi_app()
+ with Configurator() as config:
+ config.add_route('hello', '/')
+ config.add_view(hello_world, route_name='hello')
+ app = config.make_wsgi_app()
server = make_server('0.0.0.0', 6543, app)
server.serve_forever()
diff --git a/docs/quick_tutorial/package/tutorial/app.py b/docs/quick_tutorial/package/tutorial/app.py
index 210075023..d0351e251 100644
--- a/docs/quick_tutorial/package/tutorial/app.py
+++ b/docs/quick_tutorial/package/tutorial/app.py
@@ -4,14 +4,14 @@ from pyramid.response import Response
def hello_world(request):
- print ('Incoming request')
+ print('Incoming request')
return Response('<body><h1>Hello World!</h1></body>')
if __name__ == '__main__':
- config = Configurator()
- config.add_route('hello', '/')
- config.add_view(hello_world, route_name='hello')
- app = config.make_wsgi_app()
+ with Configurator() as config:
+ config.add_route('hello', '/')
+ config.add_view(hello_world, route_name='hello')
+ app = config.make_wsgi_app()
server = make_server('0.0.0.0', 6543, app)
- server.serve_forever() \ No newline at end of file
+ server.serve_forever()