On Apr 27, 11:48 am, "Gregory W. Bond" <[EMAIL PROTECTED]> wrote: > i'm trying to implement a RESTful Pylons controller and i can't figure > out how to support client-side DELETE and PUT requests - the only > suggestions i can find in the context of Pylons are > > http://pylonshq.com/pasties/12 > > and > > http://groups.google.com/group/pylons-discuss/browse_frm/thread/3463c... > > (both from Ben) > > here's an example of this approach for a client side DELETE request > > # Forms posted to this method should contain a hidden field: > # <input type="hidden" name="_method" value="DELETE" /> > # Or using helpers: > # h.form(h.url_for('${singularname}', id=ID), method='delete') > > the aforementioned approach doesn't actually use DELETE and PUT > requests - instead it uses hidden form fields - why? is there no > support for DELETE/PUT in the Pylons webhelpers?
It's not about the webhelpers, it's about browser support. They don't all know about DELETE and PUT, so POST is used with the hidden field for compatibility. > > secondly, it looks like the RESTful extensions to Routes (http:// > routes.groovie.org/manual.html#restful-services) can't be used with > this approach since they are expect true http PUT/DELETE requests so > what should the Routes config look like for this approach? map.resource does work with the hidden form field approach. Instead of implementing your own RESTful controller, you might want to check this out: http://code.google.com/p/restler/ Even if you don't use it, it might be a useful reference. There's an example app that shows how to use it (MyProject). It also includes templates that use the hidden field approach. __wyatt --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
