On 6/28/07, Jonathan LaCour <[EMAIL PROTECTED]> wrote:
> The TurboGears template, as of right now, is basically the same as
> a Pylons template, only it includes a default route to a special
> WSGIController subclass called TurboGearsController that implements
> all sorts of nice things, like object-dispatch, content-negotation,
> validation, and TG style @expose decoration. This controller is called
> the "Root" controller and is preconfigured in the routes configuration:
>
> map.connect('*url', controller='root', action='route')
>
> You can find the controller here:
>
> http://trac.turbogears.org/browser/trunk/tg/controllers.py
>
> The route method of the controller probably needs to be split up
> into some smaller, overridable chunks. The nice thing about the
> approach that we have taken thus far is that you can mix TG-style
> object-dispatching controllers and regular Pylons controllers if you
> like.
So if i want to use this for all URLs under a certain prefix, I would
direct the route to my subclass of TurboGearsController, using action
"route" (always?).
Line 66 (object_dispatch) returns my TG action method in all its
decorated glory, line 85 calls it and receives a dict, and line 88
calls a special render_response that invokes the template.
render_response is copying things out of the 'c' variable, so
templates would use '${foo}' rather than '${c.foo}' for data values.
Is this right?
I have long thought about making a TG-style dispatcher for Pylons.
It's great that somebody with more expertise has actually done it.
Noah wrote:
> The controller is also slightly different as it is based a bit on Rick
> Copeland's > q-lookup Traversable system to a degree:
> http://code.feestjeproject.com/feestje/browser/trunk/pyatl/lib/generic.py
This reminds me of Quixote, especially the '._q_lookup' method. Did
they borrow it from him or did he borrow it from them?
--
Mike Orr <[EMAIL PROTECTED]>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pylons-discuss" 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/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---