From e2c59262a9784cd227c1ca99ab11878cfd44e746 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Mon, 3 Jul 2017 20:47:07 -0700 Subject: Update example apps to use config context manager --- docs/narr/configuration.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'docs') diff --git a/docs/narr/configuration.rst b/docs/narr/configuration.rst index ee54e3acd..bbf01240e 100644 --- a/docs/narr/configuration.rst +++ b/docs/narr/configuration.rst @@ -47,9 +47,9 @@ configured imperatively: return Response('Hello world!') if __name__ == '__main__': - config = Configurator() - config.add_view(hello_world) - app = config.make_wsgi_app() + with Configurator() as config: + config.add_view(hello_world) + app = config.make_wsgi_app() server = make_server('0.0.0.0', 8080, app) server.serve_forever() @@ -116,9 +116,9 @@ and its subpackages. For example: return Response('Hello') if __name__ == '__main__': - config = Configurator() - config.scan() - app = config.make_wsgi_app() + with Configurator() as config: + config.scan() + app = config.make_wsgi_app() server = make_server('0.0.0.0', 8080, app) server.serve_forever() -- cgit v1.2.3