> > * 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...

Yea, it's not directly related, but the way it is implemented is related :)

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

Not in the current implementation.

> > * the ability to rewrite the expose decorator to just decorate the
> > method with additional attributes.
>
> Can you elaborate on this ?   :)

Sure, the expose decorator currently creates an attribute called
tg_info on the exposed function/method.  That tg_info object has
information about what engine/template to use to handle which
requests.  So the decorator doesn't really wrap the function, it just
"decorates" it with additional information.   Then the render step
just looks at the tg_info to to find out what output types are
supported and what engines to use for them.

Because the controller is recreated on each request, that tg_info
object can live on the function itself, which makes sense because that
function is what has the specific behavior we want.   Of course, we
could move tg_info into the pylons request local context object -- but
that would require adding logic to redirection to clear information
out of tg_info, so you don't get a new method exposed with the old
template :(

If there turn out to be performance issues with instantiating the
controller for each request, I have some ideas about how we can cache
controller objects -- but I'd like to avoid that kind of complexity
for now.  But the pylons people have been doing it this way for a long
time, and they tend to be a bit more performance conscious thatn TG
has been, so I think we'll be OK.

--Mark

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