Michael Merickel
2012-08-23 a2a6d9ad73dc4e0cd16c5f8b4a8720696ffdc774
Merge branch '1.3-branch' of https://github.com/virhilo/pyramid into pull.649
3 files modified
27 ■■■■ changed files
docs/narr/commandline.rst 2 ●●● patch | view | raw | blame | history
docs/narr/firstapp.rst 10 ●●●● patch | view | raw | blame | history
docs/narr/helloworld.py 15 ●●●● patch | view | raw | blame | history
docs/narr/commandline.rst
@@ -460,7 +460,7 @@
You can add request header values by using the ``--header`` option::
   $ bin/prequest --header=Host=example.com development.ini /
   $ bin/prequest --header=Host:example.com development.ini /
Headers are added to the WSGI environment by converting them to their
CGI/WSGI equivalents (e.g. ``Host=example.com`` will insert the ``HTTP_HOST``
docs/narr/firstapp.rst
@@ -127,7 +127,7 @@
.. literalinclude:: helloworld.py
   :linenos:
   :lines: 8-13
   :lines: 9-15
Let's break this down piece-by-piece.
@@ -136,7 +136,7 @@
.. literalinclude:: helloworld.py
   :linenos:
   :lines: 8-9
   :lines: 9-10
The ``if __name__ == '__main__':`` line in the code sample above represents a
Python idiom: the code inside this if clause is not invoked unless the script
@@ -169,7 +169,7 @@
.. ignore-next-block
.. literalinclude:: helloworld.py
   :linenos:
   :lines: 10-11
   :lines: 11-12
First line above calls the :meth:`pyramid.config.Configurator.add_route`
method, which registers a :term:`route` to match any URL path that begins
@@ -189,7 +189,7 @@
.. ignore-next-block
.. literalinclude:: helloworld.py
   :linenos:
   :lines: 12
   :lines: 13
After configuring views and ending configuration, the script creates a WSGI
*application* via the :meth:`pyramid.config.Configurator.make_wsgi_app`
@@ -218,7 +218,7 @@
.. ignore-next-block
.. literalinclude:: helloworld.py
   :linenos:
   :lines: 13
   :lines: 14
Finally, we actually serve the application to requestors by starting up a
WSGI server.  We happen to use the :mod:`wsgiref` ``make_server`` server
docs/narr/helloworld.py
@@ -2,14 +2,15 @@
from pyramid.config import Configurator
from pyramid.response import Response
def hello_world(request):
   return Response('Hello %(name)s!' % request.matchdict)
    return Response('Hello %(name)s!' % request.matchdict)
if __name__ == '__main__':
   config = Configurator()
   config.add_route('hello', '/hello/{name}')
   config.add_view(hello_world, route_name='hello')
   app = config.make_wsgi_app()
   server = make_server('0.0.0.0', 8080, app)
   server.serve_forever()
    config = Configurator()
    config.add_route('hello', '/hello/{name}')
    config.add_view(hello_world, route_name='hello')
    app = config.make_wsgi_app()
    server = make_server('0.0.0.0', 8080, app)
    server.serve_forever()