On Tue, Dec 1, 2009 at 2:55 PM, AF <[email protected]> wrote: > > > On Nov 30, 2:24 pm, Wesley Dyk <[email protected]> wrote: > > On Mon, Nov 30, 2009 at 12:15 AM, AF <[email protected]> wrote: > > > > > > Assuming a method "myaction(self, id)" under People(RestController): > > > > > > 1) Calling "GET /people/1/myaction" yields a 404. > > > > 2) Calling "GET /people/myaction/1" calls myaction(self,1) > > > > > > Can someone more familiar with the code confirm if the above behaviour > > > > is correct or not? > > > > > > Based on my understanding of: > > > >http://microformats.org/wiki/rest/urls#Invoke_Custom_Actions > > > > The above is not correct. But, I am not sure. > > > > > Anyone? > > > > > -- > > > > > 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]<turbogears%[email protected]> > > > . > > > For more options, visit this group at > > >http://groups.google.com/group/turbogears?hl=en. > > > > > This is a convenience of which neither implementation is RESTful. The way > > > > RESTController is designed, your get_one is never called. The dispatch > > found your myaction method in the People class, so it calls it with the > > argument. There is a Movie/MovieDirector example > > inhttp://turbogears.org/2.0/docs/main/RestControllers.html > > that shows how to get the URLs to work according to #1. Using the promote > > example, you would want to create a Promotion RESTController. This way you > > can give a People object a Promotion by sending the state to the post method > > of that object and it would follow the RESTful design guidelines of not > > putting verbs in your URLs. Another, perhaps more representative way of > > accomplishing this would be to use a JobTitle RESTController rather than a > > Promotion controller. Giving someone a promotion would just entail posting > > a jobtitle/<job title id> to a particular people/<people id>. > > > > > > Hi Wes, > > Thanks for the help. Can you point me to the docs you are referring > to that will get example #1 to work? > > -- AF > > -- > > 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. > >
AF, Look for the Nesting Resources with REST Controllers example in the page at this address: http://turbogears.org/2.0/docs/main/RestControllers.html The example doesn't show everything, but if you put the MovieController together with the second MovieDirectorController listing, you should be able to make it work. I tried this example by checking out the source and was able to make it work with the changes described in the article. Wes -- 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.

