I have now just set the mount_point to . and it seems to work, the pager 
links are correct now and I haven't noticed any other breakage...

    @cached_property
    def mount_point(self):
        return '.'

And in response to your question from irc (sorry, wasn't at home 
yesterday), yes, I need to give the sub-controllers the id of the parent 
object.

So that I get urls like

/events/eip12/lessons/1/teams/
And the lesson_id=1 is specific to the event "eip12". 
Probably like Github urls where the issue ids are unique just for the repo 
they belong to.

I thought that would have to be done using _lookup for the nested 
controllers, or is there another way that I have overseen?

Thanks,
Moritz

Am Donnerstag, 26. April 2012 22:14:23 UTC+2 schrieb Alessandro Molina:
>
> On Thu, Apr 26, 2012 at 9:12 PM, Moritz Schlarb <[email protected]> 
> wrote: 
> > Alessandro, 
> > 
> > I just ran into an issue with tgext.crud, since it generates pager links 
> > based on self._mount_point(). 
> > They look like they would have been generated from the last statically 
> > dispatched controller, so there are some parts missing. 
> > 
> > In tgext/crud/controller.py, line 144, you could probably replace 
> > tg.dispatched_controller().mount_point 
> > with 
> > request.controller_state.controller.mount_point 
> > 
>
> mount_point would return None for a non statically mounted controller, 
> so it won't probably solve the issue. 
>
> If the issue is caused by the fact that you need to allocate the 
> controllers with some options you can use cached_property to make it 
> behave as it was statically mounted. Take a look at 
>
> https://bitbucket.org/_amol_/tgapp-photos/src/81288e064f75/photos/controllers/root.py
>  
> to see what I mean. 
>
> If you really need to serve the controllers from _lookup you must 
> override _mount_point to use request.path_info 
> Something like 
> request.path_info[len(tg.dispatched_controller().mount_point):].split('/')[0] 
>
> might be the way to go, but I don't have any ready made snippet for 
> something like that as I always served crud rest controllers from 
> statically mounted places or cached properties. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/turbogears/-/jx0frpf1PwUJ.
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