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 in
http://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>.

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.


Reply via email to