REST gets a lot of press these days, it seems. However, I haven't found many examples of how it works in practice. It seems that put and delete methods need to be called via XMLHttpRequest (AJAX).
Pylons and some other frameworks can work with browser-unsupported HTTP verbs by using a hidden input field. The formcontents are POSTed to the server as usual, the framework will see the hidden field and translate it to the proper call in the application, i.e.: <input type="hidden" name="_method" value="DELETE" /> Also have a look at the Routes documentation[1] concerning REST. To request a form representation of a resource (for preparing edits that can be PUTted) map.resource from Routes (and others) suggests adding ';edit' to the URL. For instance a request to /foo/1;edit should result in a form. Combined with a hidden "_method" input field it is possible to use RESTful operations with classic POST and redirect interaction between browser and server. No AJAX or any Javascript is required for this. I'd like to add one question of my own. Should there be a "Are you sure you want to delete?" representation added to map.resource? It's easy to add a member but shouldn't the framework offer a convention? [1] http://routes.groovie.org/manual.html#restful-services --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pylons-discuss" 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/pylons-discuss?hl=en -~----------~----~----~----~------~----~------~--~---
