On Apr 27, 2007, at 11:48 AM, Gregory W. Bond wrote:
> 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?
Because web browsers don't send DELETE/PUT, they can only send POST/
GET/HEAD. So to have a consistent resource setup that does work with
other clients that can send DELETE/PUT, the helpers use hidden form
fields, and Routes will swap those fields in during matching to
simulate a DELETE/PUT that a browser can handle.
Did you see the 'paster create restcontroller' command that creates a
controller template for use with map.resource?
> 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?
Routes will look for the hidden method that the helpers generate and
match appropriately.
Cheers,
Ben
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---