Ahh, I figured it out myself.  The default route picks this up:

self.app.post('/comments/update/1', ...)

I had forgotten about the default route, :o.

jw

On Oct 23, 4:02 pm, "programmer.py" <[EMAIL PROTECTED]> wrote:
> Hi all.
>
> I've created a REST controller like this:
>
> $ paster restcontroller comment comments
>
> Next, I added it to my routes...
>
> # inside project/config/routing.py
> map.resource('comment', 'comments')
>
> Next, I modify each method in my comments controller to return it's
> string name:
>     def index(self, format='html'):
>         """GET /comments: All items in the collection."""
>         # url_for('comments')
>         return 'index'
>
>     def create(self):
>         """POST /comments: Create a new item."""
>         # url_for('comments')
>         return 'create'
>
>     def new(self, format='html'):
>         """GET /comments/new: Form to create a new item."""
>         # url_for('new_comment')
>         return 'new'
> ...
>
> Finally, I create a test, that I expect to be routed to here ->
> Comments.update
>
> But instead, I get routed to ->
> Comments.index
>
> The test is below:
>     def test_update(self):
>         response = self.app.post(url_for('comments', id = 1),
>                                  dict(somekey='someval',
>                                       _method='put'))
>         response.mustcontain('update')
>
> Anyone have any ideas how to match the route I'm after?
>
> Thanks!
> jw


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to