Cheers for that!

I've read the docs and the code, but I'm still confused about certain
aspects of the response. In particular, what is the purpose of the
iterable? Is the idea that the total response, as it comes down from
the application and through the middleware, should be constructed as a
"stack" (eg, a list) of the individual responses from each WSGI
application, a stack that gets "flattened" before it gets written out
the socket?

This seems like really desirable behavior, one that would make
filtering the response much easier at lower levels in the middleware.
My middleware hopes to implement some response-filtering
functionality, and I'd like to take advantage of this mechanism, if it
is indeed intended that way.

Thanks again for the help!
~br

On Aug 13, 9:03 pm, Wyatt Baldwin <[email protected]> wrote:
> On Aug 13, 7:36 pm, BrianTheLion <[email protected]> wrote:
>
> > I'm building some WSGI middleware and have noticed some odd behavior
> > with respect to return values from controller methods:
>
> > When a controller method returns a string, downstream middleware gets
> > a response of <type 'list'> where the first (and only) item in the
> > list is the string.
>
> > BUT
>
> > When a controller method returns an non-string, downstream middleware
> > just gets the object itself, not inside a list.
>
> > Does anybody know where the code responsible for this behavior lives?
>
> Your controller is called from here:
>
> http://bitbucket.org/bbangert/pylons/src/tip/pylons/wsgiapp.py#cl-101
>
> And this is where string content returned from your action gets
> appended to the response body:
>
> http://bitbucket.org/bbangert/pylons/src/tip/pylons/controllers/core....
>
> I'm guessing a string response is wrapped in a list because a WSGI
> response can be an iterable, but you wouldn't want to iterate over the
> characters in a string.

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to