On Jan 1, 2007, at 7:02 AM, Sean Davis wrote:
Thank. This clarifies a lot for me. I have tried using the
map.resource() methods and the hidden field method for performing a
delete, for example. Under pylons, does the translation from the
hidden field to http method happen before dispatch via routes? It
seems like it isn't happening, as when I have html that looks like
this:
As Routes does the lookup for controller/action, it does do the
_method check.
<td><form method="post"
action="/talks/1" class="button-to"><div><
input onclick="return confirm('Are you sure?');" type=
"submit" value="Destroy" /></div></
form></td>
If you the helper method h.form(), you can give it a put/delete
method and it will create the appropriate hidden fields, ie:
h.form(h.url_for('talk', id=1), method='delete')
And a map.resource('talk','talks') with a talks.py controller and a
delete(self,id) method, I get an error and the method on the debug
page says "POST". Any thoughts?
I'm guessing this is because a POST to a individual resource is
meaningless in RESTful applications. You can PUT to a specific
resource to update it, DELETE the resource, or GET the resource.
Under a typical RESTful setup, you POST to the resource collection to
add new members. (Atom Publishing Protocol serves as the best model
for a RESTful app I believe, which is what this setup duplicates).
HTH,
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
-~----------~----~----~----~------~----~------~--~---