#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 <http://www.turbogears.org/>
TurboGears front-to-back web development
--
You received this message because you are subscribed to the Google
Groups "TurboGears Tickets" group.
This group is read-only. No posting by normal members allowed.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/turbogears-tickets?hl=en?hl=en