[Paste] webob, get_response, and a few small docs fixes

Top Page
Author: Jon Nelson
Date:  
To: Paste Users
Subject: [Paste] webob, get_response, and a few small docs fixes
According to the docs, this should work:

    >>> import pprint
    >>> from webob import Request
    >>> def environ_app(environ, start_response):
    ...   start_response('200', ['Content-Type: text/plain'])
    ...   return pprint.pformat(environ)
    ...
    >>> req = Request.blank('/')
    >>> r = req.get_response(environ_app)
    >>> print r

But it doesn't. :-(

I've included a doctest for this as well as some very small docs tweaks.


I'm also curious when the next webob release might be, there appear to
be some fixes in svn that might be useful!


-- 
Jon

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Paste Users" group.
To post to this group, send email to paste-users@???
To unsubscribe from this group, send email to paste-users+unsubscribe@???
For more options, visit this group at http://groups.google.com/group/paste-users?hl=en
-~----------~----~----~----~------~----~------~--~---

diff --git a/docs/do-it-yourself.txt b/docs/do-it-yourself.txt
index 60cfcb1..8aeabaa 100644
--- a/docs/do-it-yourself.txt
+++ b/docs/do-it-yourself.txt
@@ -31,7 +31,7 @@ A very simple application looks like this:

 The ``environ`` argument is a dictionary with values like the environment in a CGI request.  The header ``Host:``, for instance, goes in ``environ['HTTP_HOST']``.  The path is in ``environ['SCRIPT_NAME']`` (which is the path leading *up to* the application), and ``environ['PATH_INFO']`` (the remaining path that the application should interpret).

-We won't focus much on the server, but we will use WebOb to handle the application. WebOb in a way has a simple server interface. To use it you create a new request with ``req = webob.Request('http://localhost/test')``, and then call the application with ``resp = req.get_response(app)``. For example:
+We won't focus much on the server, but we will use WebOb to handle the application. WebOb in a way has a simple server interface. To use it you create a new request with ``req = webob.Request.blank('http://localhost/test')``, and then call the application with ``resp = req.get_response(app)``. For example:

 .. code-block:: python

diff --git a/tests/test_response.txt b/tests/test_response.txt
index c4e5ed3..a2c75a7 100644
--- a/tests/test_response.txt
+++ b/tests/test_response.txt
@@ -151,8 +151,19 @@ request object attached.
     >>> res.location
     'http://localhost/test2.html'

+Test the __str__ method when used with a wsgi application::
+
+ >>> import pprint
+ >>> def environ_app(environ, start_response):
+ ... start_response('200', ['Content-Type: text/plain'])
+ ... return pprint.pformat(environ)
+ ...
+ >>> req = Request.blank('/')
+ >>> r = req.get_response(environ_app)
+ >>> r = str(r)
+
 There's some conditional response handling too (you have to turn on
-conditioanl_response)::
+conditional_response)::

     >>> res = Response(conditional_response=True)
     >>> req = Request.blank('/')