There is an example on
http://turbogears.readthedocs.org/en/latest/turbogears/restdispatch.html?highlight=rest#nesting-resources-with-restcontrollers

If you are using a recent TurboGears version (2.3.3+) you can even use the
_visit method of controller which is executed each time you pass though a
controller during the dispatch to store the workspace inside request so
that it will be available in users controller:
http://turbogears.readthedocs.org/en/latest/turbogears/objectdispatch.html?highlight=_visit#dispatching-entry-points



On Fri, Sep 12, 2014 at 4:36 PM, lebouquetin <[email protected]> wrote:

> Hi all,
>
> I work on a web application based on RESTful urls.
>
> I'd like to be able to manage users of a workspace through combined
> RESTController instances:
>
> for example, /workspace/5/users/4/edit allowing to edit the user #4
> profile in workspace#5
>
> I have 2 RestController instance :
>
> UserController(RestController):
>     ...
>
>     @expose()
>     def get_one(self, user_id):
>         # I want to get the workspace id here <------------------------
>         return "it works"
>
> WorkspaceController(RestController):
>     ...
>
>     users = UserController()
>
>
> When going to http://localhost/workspaces/4/users/5, I get the route ok,
> but I'd like to access the workspace id from the user controller (ie child
> controller).
> How should I do ?
>
> I searched the documentation but there are only basic examples.
>
> Thanks.
>
> Damien
>
> --
> You received this message because you are subscribed to the Google Groups
> "TurboGears" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/turbogears.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/turbogears.
For more options, visit https://groups.google.com/d/optout.

Reply via email to