summaryrefslogtreecommitdiff
path: root/docs/quick_tour
diff options
context:
space:
mode:
authorSteve Piercy <web@stevepiercy.com>2017-07-03 21:06:56 -0700
committerSteve Piercy <web@stevepiercy.com>2017-07-03 21:06:56 -0700
commite33212c6746cbf50c4952b5d8c8d93714cf06ccd (patch)
treee353e5753ea98e2aec850de4beda963ca8ef8f1f /docs/quick_tour
parentb6937e32be59a214bac5a8097bf5b200eb7b5ac8 (diff)
downloadpyramid-e33212c6746cbf50c4952b5d8c8d93714cf06ccd.tar.gz
pyramid-e33212c6746cbf50c4952b5d8c8d93714cf06ccd.tar.bz2
pyramid-e33212c6746cbf50c4952b5d8c8d93714cf06ccd.zip
Update example apps to use config context manager in Quick Tour
- add missing EOF line ending
Diffstat (limited to 'docs/quick_tour')
-rw-r--r--docs/quick_tour/hello_world/app.py8
-rw-r--r--docs/quick_tour/jinja2/app.py10
-rw-r--r--docs/quick_tour/json/app.py14
-rw-r--r--docs/quick_tour/requests/app.py8
-rw-r--r--docs/quick_tour/routing/app.py10
-rw-r--r--docs/quick_tour/static_assets/app.py12
-rw-r--r--docs/quick_tour/templating/app.py10
-rw-r--r--docs/quick_tour/view_classes/app.py14
-rw-r--r--docs/quick_tour/views/app.py14
9 files changed, 50 insertions, 50 deletions
diff --git a/docs/quick_tour/hello_world/app.py b/docs/quick_tour/hello_world/app.py
index 75d22ac96..dc6f32310 100644
--- a/docs/quick_tour/hello_world/app.py
+++ b/docs/quick_tour/hello_world/app.py
@@ -8,9 +8,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_tour/jinja2/app.py b/docs/quick_tour/jinja2/app.py
index b7632807b..2683e0451 100644
--- a/docs/quick_tour/jinja2/app.py
+++ b/docs/quick_tour/jinja2/app.py
@@ -2,10 +2,10 @@ from wsgiref.simple_server import make_server
from pyramid.config import Configurator
if __name__ == '__main__':
- config = Configurator()
- config.add_route('hello', '/howdy/{name}')
- config.include('pyramid_jinja2')
- config.scan('views')
- app = config.make_wsgi_app()
+ with Configurator() as config:
+ config.add_route('hello', '/howdy/{name}')
+ config.include('pyramid_jinja2')
+ config.scan('views')
+ app = config.make_wsgi_app()
server = make_server('0.0.0.0', 6543, app)
server.serve_forever()
diff --git a/docs/quick_tour/json/app.py b/docs/quick_tour/json/app.py
index 40faddd00..a007dee14 100644
--- a/docs/quick_tour/json/app.py
+++ b/docs/quick_tour/json/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()
diff --git a/docs/quick_tour/requests/app.py b/docs/quick_tour/requests/app.py
index f55264cff..58e8823cc 100644
--- a/docs/quick_tour/requests/app.py
+++ b/docs/quick_tour/requests/app.py
@@ -16,9 +16,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_tour/routing/app.py b/docs/quick_tour/routing/app.py
index 12b547bfe..75c18b7d1 100644
--- a/docs/quick_tour/routing/app.py
+++ b/docs/quick_tour/routing/app.py
@@ -2,9 +2,9 @@ from wsgiref.simple_server import make_server
from pyramid.config import Configurator
if __name__ == '__main__':
- config = Configurator()
- config.add_route('hello', '/howdy/{first}/{last}')
- config.scan('views')
- app = config.make_wsgi_app()
+ with Configurator() as config:
+ config.add_route('hello', '/howdy/{first}/{last}')
+ config.scan('views')
+ 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()
diff --git a/docs/quick_tour/static_assets/app.py b/docs/quick_tour/static_assets/app.py
index 1849c0a5a..c31fc797c 100644
--- a/docs/quick_tour/static_assets/app.py
+++ b/docs/quick_tour/static_assets/app.py
@@ -2,11 +2,11 @@ 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_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_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()
diff --git a/docs/quick_tour/templating/app.py b/docs/quick_tour/templating/app.py
index 52b7faf55..8db99df91 100644
--- a/docs/quick_tour/templating/app.py
+++ b/docs/quick_tour/templating/app.py
@@ -2,10 +2,10 @@ from wsgiref.simple_server import make_server
from pyramid.config import Configurator
if __name__ == '__main__':
- config = Configurator()
- config.add_route('hello', '/howdy/{name}')
- config.include('pyramid_chameleon')
- config.scan('views')
- app = config.make_wsgi_app()
+ with Configurator() as config:
+ config.add_route('hello', '/howdy/{name}')
+ config.include('pyramid_chameleon')
+ config.scan('views')
+ app = config.make_wsgi_app()
server = make_server('0.0.0.0', 6543, app)
server.serve_forever()
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()
diff --git a/docs/quick_tour/views/app.py b/docs/quick_tour/views/app.py
index e8df6eff2..12d9d25b5 100644
--- a/docs/quick_tour/views/app.py
+++ b/docs/quick_tour/views/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('home', '/')
- config.add_route('hello', '/howdy')
- config.add_route('redirect', '/goto')
- config.add_route('exception', '/problem')
- config.scan('views')
- app = config.make_wsgi_app()
+ with Configurator() as config:
+ config.add_route('home', '/')
+ config.add_route('hello', '/howdy')
+ config.add_route('redirect', '/goto')
+ config.add_route('exception', '/problem')
+ config.scan('views')
+ app = config.make_wsgi_app()
server = make_server('0.0.0.0', 6543, app)
server.serve_forever()