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-resources-with-restcontrollers
--
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.