On Dec 28, 4:12 pm, "programmer.py" <[email protected]> wrote:
> Hi everyone.  I'm sure I'm overlooking something very simple, but I
> can't get the `format` parameter to work correctly.
>
> Can anyone verify that this is / is not working?
>
> Here is how I create the problem (or what I think is the problem):
>
> 1.  Create a simple pylons (0.9.7rc4).
>
> 2.  Add user restful controller:
>     paster restcontroller  user users
>
> 3.  Add map.resource to config/routing.py:
>     # CUSTOM ROUTES HERE
>     map.resource('user', 'users')
>
> 4.  Modify user controller
>
>     def index(self, format='html'):
>         """GET /users: All items in the collection."""
>         # url('users')
>         return 'Format -> %s' % format
>
> 5.  Fetch the resource.
>
> http://127.0.0.1:5000/users?format=json
>
> After fetching the resource, I expected to see the string 'json', but
> instead I see HTML.  Ideas?

Try http://127.0.0.1:5000/users.json. Passing format as a query param
means you'd need to access it via `request.params`.
--~--~---------~--~----~------------~-------~--~----~
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