On Mon, Nov 17, 2008 at 9:44 PM, Ken Kuhlman <[EMAIL PROTECTED]> wrote:
>
> 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.

And here I follow both Fumanchu and you. Less surprising and better
performance... this seems to be the way to go (tree.graft). I feel
that this second proposition is more explicit than the first one and
will avoid potential issues with the decoding filters and so on.

As discussed earlier and already changed by you in the ticket, I feel
this should go either in 1.5 or at least in a future 1.1 but not in
this beta.

Florent.

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to