i just gave this a try and it sort of worked as expected - let me
explain:
for my example i tried to emulate a DELETE using
h.button_to("Delete", h.url_for(id=num.number), method="delete")
which translated to
<form method="POST" action="/users/john/numbers?id=5555681212"
class="button-to"><div><input id="_method" name="_method"
type="hidden" value="delete" /><input type="submit" value="Delete" /></
div></form>
all as expected so far....
now pressing the "Delete" button generates a POST request of the form:
http://localhost:5000/users/john/numbers?id=5555681212
my DELETE routing rule matches (!):
map.connect('users/:user/numbers', controller='users/numbers/numbers',
action='delete', conditions=dict(method=['DELETE']))
however, note that the 'id' is provided as a request parameter, not as
part of the request URL - for this reason i can't use the conventional
RESTful routing rule for DELETE which would be:
map.connect('users/:user/numbers/:number', controller='users/numbers/
numbers', action='delete', conditions=dict(method=['DELETE']))
so the 'delete' function of my controller has to extract the 'id' to
delete from the request params, it's not provided as a function
argument
am i doing things correctly here or am i missing something?
On Apr 27, 4:11 pm, "Gregory W. Bond" <[EMAIL PROTECTED]> wrote:
> thanks for the prompt reply ben - i suspected that browsers might not
> support PUT/DELETE and that made me sad since i could envision the big
> mess that my routes would have to be to accommodate browsers along
> with web-services clients that do support PUT/DELETE
>
> but if what you're saying really works (and i imagine it will ;-) )
> i'll be super-impressed with pylons/routes for it's ability to hide
> this complexity for me
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---