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.py#cl-215 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.
