summaryrefslogtreecommitdiff
path: root/docs/designdefense.rst
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2018-03-13 17:19:44 -0400
committerChris McDonough <chrism@plope.com>2018-03-13 17:19:44 -0400
commitbf59bd87ce2d8dc35f9585087623528bb58363a3 (patch)
treeea5cb12fee6e4453bb8e0bf6b943e1451de7cc73 /docs/designdefense.rst
parentb2e8884a94d9e869bf29ea55298ad308f16ed420 (diff)
parent47ff29297c65ae2c8da06a5bb2f361f806681ced (diff)
downloadpyramid-bf59bd87ce2d8dc35f9585087623528bb58363a3.tar.gz
pyramid-bf59bd87ce2d8dc35f9585087623528bb58363a3.tar.bz2
pyramid-bf59bd87ce2d8dc35f9585087623528bb58363a3.zip
Merge branch 'master' of github.com:Pylons/pyramid
Diffstat (limited to 'docs/designdefense.rst')
-rw-r--r--docs/designdefense.rst26
1 files changed, 13 insertions, 13 deletions
diff --git a/docs/designdefense.rst b/docs/designdefense.rst
index 0a72ff27d..c0a1f8336 100644
--- a/docs/designdefense.rst
+++ b/docs/designdefense.rst
@@ -1433,7 +1433,7 @@ object which *is not logically global*:
# credentials were invalid
The `Pylons 1.X
-<http://docs.pylonsproject.org/projects/pylons-webframework/en/latest/>`_
+<https://docs.pylonsproject.org/projects/pylons-webframework/en/latest/>`_
web framework uses a similar strategy. It calls these things "Stacked Object
Proxies", so, for purposes of this discussion, I'll do so as well.
@@ -1529,20 +1529,20 @@ inlined comments take into account what we've discussed in the
.. code-block:: python
:linenos:
- from pyramid.response import Response # explicit response, no thread local
- from wsgiref.simple_server import make_server # explicitly WSGI
+ from wsgiref.simple_server import make_server # explicitly WSGI
+ from pyramid.config import Configurator # to configure app registry
+ from pyramid.response import Response # explicit response, no threadlocal
- def hello_world(request): # accepts a request; no request thread local reqd
+ def hello_world(request): # accept a request; no request threadlocal reqd
# explicit response object means no response threadlocal
return Response('Hello world!')
if __name__ == '__main__':
- from pyramid.config import Configurator
- config = Configurator() # no global application object
- config.add_view(hello_world) # explicit non-decorator registration
- app = config.make_wsgi_app() # explicitly WSGI
+ with Configurator() as config: # no global application object
+ config.add_view(hello_world) # explicit non-decorator registration
+ app = config.make_wsgi_app() # explicitly WSGI
server = make_server('0.0.0.0', 8080, app)
- server.serve_forever() # explicitly WSGI
+ server.serve_forever() # explicitly WSGI
Pyramid doesn't offer pluggable apps
@@ -1634,7 +1634,7 @@ Let's take this criticism point-by-point.
Too Complex
+++++++++++
-If you can understand this hello world program, you can use Pyramid:
+If you can understand this "hello world" program, you can use Pyramid:
.. code-block:: python
:linenos:
@@ -1647,9 +1647,9 @@ If you can understand this hello world program, you can use Pyramid:
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()