Re: [TurboGears] #2458: [PATCH] Allow custom REST-like methods in RestController

20 views
Skip to first unread message

TurboGears

unread,
Feb 3, 2010, 4:40:18 AM2/3/10
to turbogear...@googlegroups.com
#2458: [PATCH] Allow custom REST-like methods in RestController
-------------------------+--------------------------------------------------
Reporter: lento | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: __unclassified__
Component: TurboGears | Version: trunk
Severity: normal | Resolution:
Keywords: |
-------------------------+--------------------------------------------------
Changes (by lento):

* version: 2.0b7 => trunk

--
Ticket URL: <http://trac.turbogears.org/ticket/2458#comment:1>
TurboGears <http://www.turbogears.org/>
TurboGears front-to-back web development

TurboGears

unread,
Feb 3, 2010, 4:38:57 AM2/3/10
to turbogear...@googlegroups.com
#2458: [PATCH] Allow custom REST-like methods in RestController
-------------------------+--------------------------------------------------
Reporter: lento | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: __unclassified__
Component: TurboGears | Version: 2.0b7
Severity: normal | Keywords:
-------------------------+--------------------------------------------------
This allows to have a consistent API in case you have custom methods in
your !RestController, exposing them the same way as the default REST
verbs.

For example you can define get_archive() and post_archive() in your
"movies" controller from the moviedemo example:
{{{
custom_actions = ['archive']

@expose('moviedemo.templates.forms.form')
def get_archive(self, movie_id, **kwargs):
"""Display a ARCHIVE confirmation form."""

@expose('moviedemo.templates.forms.result')
def post_archive(self, movie_id):
"""Archive a movie"""
}}}

or just
{{{
custom_actions = ['archive']

@expose('moviedemo.templates.forms.result')
def archive(self, movie_id):
"""Archive a project"""
}}}

and use them like this:

GET /movies/1/archive

POST /movies/1?_method=ARCHIVE

--
Ticket URL: <http://trac.turbogears.org/ticket/2458>

TurboGears

unread,
Feb 23, 2010, 10:15:50 AM2/23/10
to turbogear...@googlegroups.com
#2458: [PATCH] Allow custom REST-like methods in RestController
-------------------------+--------------------------------------------------
Reporter: lento | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: 2.1b2
Component: TurboGears | Version: 2.1
Severity: normal | Resolution:
Keywords: |
-------------------------+--------------------------------------------------
Changes (by jorge.vargas):

* version: trunk => 2.1
* milestone: __unclassified__ => 2.1b2

Comment:

This patch looks good.

--
Ticket URL: <http://trac.turbogears.org/ticket/2458#comment:2>

TurboGears

unread,
Feb 23, 2010, 1:03:24 PM2/23/10
to turbogear...@googlegroups.com
#2458: [PATCH] Allow custom REST-like methods in RestController
-------------------------+--------------------------------------------------
Reporter: lento | Owner:
Type: enhancement | Status: closed

Priority: normal | Milestone: 2.1b2
Component: TurboGears | Version: 2.1
Severity: normal | Resolution: fixed
Keywords: |
-------------------------+--------------------------------------------------
Changes (by percious):

* status: new => closed
* resolution: => fixed

Comment:

implemented in http://bitbucket.org/turbogears/tg-
dev/changeset/39da27c2c339/ (2.1b2 release) uses _custom_actions instead
of custom_actions for the attribute. Needs to be documented. Tests have
been added for the use case.

--
Ticket URL: <http://trac.turbogears.org/ticket/2458#comment:3>

Reply all
Reply to author
Forward
0 new messages