« Return to Thread: CrudRestController and @before_validate
On Thu, Apr 26, 2012 at 9:12 PM, Moritz Schlarb <mail@...> 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.
« Return to Thread: CrudRestController and @before_validate
| Free embeddable forum powered by Nabble | Forum Help |