import logging from pylons import request, response, session, tmpl_context as c from pylons.controllers.util import abort, redirect_to {{importstatement}} log = logging.getLogger(__name__) class {{classname}}Controller(BaseController): """REST Controller styled on the Atom Publishing Protocol""" # To properly map this controller, ensure your config/routing.py # file has a resource setup: # {{resource_command}} def index(self, format='html'): """GET /{{nameprefix}}{{pluralname}}: All items in the collection""" # url('{{nameprefix}}{{pluralname}}') def create(self): """POST /{{nameprefix}}{{pluralname}}: Create a new item""" # url('{{nameprefix}}{{pluralname}}') def new(self, format='html'): """GET /{{nameprefix}}{{pluralname}}/new: Form to create a new item""" # url('{{nameprefix}}new_{{singularname}}') def update(self, id): """PUT /{{nameprefix}}{{pluralname}}/id: Update an existing item""" # Forms posted to this method should contain a hidden field: # # Or using helpers: # h.form(url('{{nameprefix}}{{singularname}}', id=ID), # method='put') # url('{{nameprefix}}{{singularname}}', id=ID) def delete(self, id): """DELETE /{{nameprefix}}{{pluralname}}/id: Delete an existing item""" # Forms posted to this method should contain a hidden field: # # Or using helpers: # h.form(url('{{nameprefix}}{{singularname}}', id=ID), # method='delete') # url('{{nameprefix}}{{singularname}}', id=ID) def show(self, id, format='html'): """GET /{{nameprefix}}{{pluralname}}/id: Show a specific item""" # url('{{nameprefix}}{{singularname}}', id=ID) def edit(self, id, format='html'): """GET /{{nameprefix}}{{pluralname}}/id/edit: Form to edit an existing item""" # url('{{nameprefix}}edit_{{singularname}}', id=ID)