Thanks Jonathan and Mark...

On 7/18/07, Mark Ramm <[EMAIL PROTECTED]> wrote:
>
> > Why will TG2 instantiate controllers on each request ? What are the
> > pros and cons of the actual model of TG 1 (one instance of each
> > controller in the entire lifetime of the application process) ?
>
> Well, the real reason is because that's what Pylons does, so if we
> build on Pylons that's what we'll do. :) It's also easy to run
> multiple instances of the same pylons/tg2 app in one process which
> would be harder to do if controllers were global in memory objects.
>
> But the other advantages are:
>
> * TG2 controllers will have __before__ and __after__ methods which
> will always be run before or after your controller method

Nice feature, but it's not directly related with this "create on
request" behavior, I suppose...

What happens if a method_a does an internal redirect to method_b ?
Will __before__ and __after__ be called twice ?


> * the ability to rewrite the expose decorator to just decorate the
> method with additional attributes.

Can you elaborate on this ?   :)


> Pylons has a global state object they call g which can store global
> state information, and a request local state object called c, so you
> still have access to state information, it's just a bit more
> controlled.

Ok... I don't have problems with that... all my controllers are
completely stateless..:)


> The potential downside is the extra time on each request spent
> instantiating the controller, but that hasn't been a problem, and is
> very unlikely to become the performance bottleneck.

TG2 will emulates cherrypy dispatching model, right ?

Lets suppose i have this hierarchy of controllers:

Foo
 + Bar
    + Alpha
    + Beta
 + Zeta


If someone requests my  /foo/bar/method/, it will create only the Foo
and Bar controllers, right (for that request) ?


While I've been watching Pylons ML for some months, I've never touched
it actually...
Maybe some of my questions should be easily answered if I would have
dirty my hands doing some experiments with Pylons... :)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" 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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to