Mark Ramm wrote:

> What kind of errors were you getting when we didn't re-instantiate
> on each request?

When making several requests in a very short period of time, we were
having issues where one request's data would end up getting appended
to the next request's data.  In our case, this was resulting in
corrupted JSON on some of our AJAX requests, and occasionally we'd
see our entire app go haywire, and entire pages would show up with
the *previous* request's page embedded within it.

Nasty, nasty stuff :) Ben and I discussed this a bit, and it seems
like Pylons is designed from the ground up to expect *fresh*
controller instances on every request.  I think this is a reasonable
approach, that just happens to break down on object dispatch the way
we've implemented it right now.

> I'd like to be able to keep the root controller object around, but
> I agree it's not worth it at this point.  (However, if we're doing
> this, I'm tempted to go back to the *route way and just re-use the
> pylons app entirely).  That way people with large projects could
> mitigate the impact of this by using routes to break up their
> object trees into much smaller entities.

Sure, this is a totally valid way to go, and I don't really have an
issue with it if we want to go this direction.  That being said,
I also think its possible for us to fix this problem by doing
something like this:

     class RootController(tg.TurboGearsController):

         sub_one = tg.SubControllerProxy(MySubControllerOne)
         sub_two = tg.SubControllerProxy(MySubControllerTwo)

The tg.SubControllerProxy could act as a proxy to the passed
subcontroller class, only instantiating it if required by the
request itself.  This should be relatively easy to implement, and
would act as a nice optimization for people who care about speed,
without requiring people to understand Routes, or break their
hierarchy up into a bunch of chunks.

--
Jonathan LaCour
http://cleverdevil.org

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