Hello,

You might find it useful to refer to the following thread:

http://groups.google.com/group/turbogears/browse_thread/thread/47ecba39f1e2f9c4/22014d75378809b0

Plus, I have found (what seems to be) a TG2 bug, and have posted the
associated diff for the fix.

Hope this helps!
ozwyzard

On Aug 16, 12:07 pm, Ionuț Arțăriși <[email protected]> wrote:
>   Hello,
>
> The documentation on nesting RestControllers[1] appears to be broken.
>
> Looking at the first example:
>
> class MovieDirectorController(RestController):
>
>     �...@expose('moviedemo.templates.rest.movie_directors.get_all')
>      def get_all(self):
>          movie = DBSession.query(Movie).get(movie_id)
>          return dict(movie=movie, directors=movie.directors)
>
> Where is movie_id declared? Does TurboGears know how to extract it from
> MovieRestController? That would be cool, but it doesn't seem to work.
>
> Looking at the second example:
>
> def __before__(self, *args, **kw):
>          movie_id = request.url.split('/')[-3]
>
> Isn't there a better way of extracting the argument than brute-force
> parsing the request's url? Also, this example will not work for all of
> the different ways of accessing a RestController method. For example:
>
> DELETE 'movies/3/directors/4' -> movie_id is 3
> POST 'movies/3/directors/4/delete' -> movie_id is 'directors'
>
> So what is the proper way of extracting the argument used in the outer
> RestController (in this case movie_id) for use in the nested RestController?
>
> Thanks.
>
> [1]http://turbogears.org/2.1/docs/main/RestControllers.html#nesting-reso...

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" 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?hl=en.

Reply via email to