This issue seems to hinge on what is a request, and when is a new response created. I hadn't realized these were in doubt. But in case it's helpful to anybody...
A request comes in, and Pylons creates a global 'request' and 'response', and routes to the action. (These are global variables, but through the magic of StackedObjectProxy, they are local to the current request, thread, and application.) Normally the action method returns a string, and Pylons plugs it into the global response and sends it to the browser. 'render()' fills a template and returns a string, so this is still the normal case. The action can also change the response's status or headers; e.g., ``response.status = 401``. The action can also create its own Response object and return it, in which case it supercedes the global response object. When an action method calls another action method, it's still the same request, and the global 'request' and 'response' objects are the same. The second method can return a string, change the status or headers, or return a new Response object, as it wishes. The original action must pass the result of the second action through by returning it, or it will be lost. If you don't explicitly return a value, the default value is None as with all functions, and an empty page will be sent to the browser. Thus, there's no such thing in Pylons of transfering to another request -- or there is, depending on how you define a request. But in the code executed, what matters is the string returned by the original action and the final setting of the headers -- no matter which functions were called to produce this state. Calling 'redirect()' raises an HTTPRedirection that bypasses some of this processing, and the net result is that the 'response' status is changed and a Location: header added, so a redirect is sent to the browser. Alfredo Deza and I are updating the Pylons Execution Analysis. It's a bit inconsistent now because it's partway between Pylons 0.9.6 and Pylons 0.10, so don't trust it too closely, but the draft might give a bird's eye view of what's going on: http://bitbucket.org/sluggo/pylons-execution/src/tip/execution.rst -- Mike Orr <[email protected]> -- 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.
