On Sun, Nov 16, 2008 at 7:00 PM, Christopher Arndt <[EMAIL PROTECTED]> wrote:
>
> Ken Kuhlman schrieb:
>> I'm struggling with the decision of whether I should backport
>> "use_wsgi_app"-type functionality to tg1.1b2,
>
> I think that full wsgi-compliance isn't a key feature of TG 1.1. Florent
> told me in a chat that he agrees with this view. So I think it's ok to
> move this to te next major release.
>
I agree completely. The only reason I moved the ticket to 1.1 in the
first place was that it looked simple at the time. I've put it back
to 1.5 now, with a note that it may be closed as wontfix depending on
the outcome of this discussion.
>> if I should hold off
>> until 1.5, or even if it's a mis-feature that shouldn't be backported
>> at all.
>
> Point c) certainly seems a strong point in favor of rejecting this as
> "wontfix", but would be the alternatives?
>
> Chris
>
I don't think I was clear about point c), let me try again. The one
advantage of implementing a tools.wsgiapp-based approach is that you
then can use other CherryPy tools as middleware for the hosted wsgi
application. The patch in question uses this technique, so with it
you could secure a foreign wsgi app with identity as is.
The advantage of using tree.graft instead are more subtle. Robert
Brewer's advocacy for it is mostly based on performance concerns.
Mine is based on the principal of least surprise. Consider the
following controller, which uses the tool-based solution:
class MyRoot(RootController):
@expose()
def index(self):
return 'Hello'
blog = use_wsgi_app(some_wsgi_blog_app)
cherrypy.tree.mount(MyRoot)
Reading this, you would expect that 'blog' would have the same set of
middleware applied to it as 'index', and in fact that would be the
simplest implementation. But that's not always going to be the right
answer since 'some_wsgi_blog_app' is going to come equipped with it's
own set of middleware. For example, it is going to have it's own
mechanism for decoding query parameters, so the NestedVariablesHook is
redundant at best and intrusive at worst.
The tree.mount() syntax for this same setup would be like so:
class MyRoot(RootController):
@expose()
def index(self):
return 'Hello'
cherrypy.tree.mount(MyRoot)
cherrypy.tree.graft(some_wsgi_blog_app, '/blog')
The least surprising thing for this code to do would be for the two
app's middleware to be kept seperate, which is also the safest
behavior. If there is middleware that the developer wants to use in
both portions of the site, they can take advantage of the fact that
cherrypy.tree is itself a wsgi application and just wrap that.
-Ken
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears Trunk" 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/turbogears-trunk?hl=en
-~----------~----~----~----~------~----~------~--~---