...

I had to create another route to catch a specific User

    config.add_route("users", '/user/')
    config.add_route("user_details", '/user/{user_id}')


Mário Idival
Python Developer

*Twitter|Github|Skype *: *marioidival*
*Facebook*: *mario.idival*
*User Linux** : **#554446*

2015-03-04 16:45 GMT-03:00 Mário Idival <[email protected]>:

> I am writing a tutorial, "Creating REST API with Pyramid - free
> dependencies", and arrived at a point where the GET request should get a
> list of users and a specific user...
>
> /users/
> /users/{user_id}
>
> Mário Idival
> Python Developer
>
> *Twitter|Github|Skype *: *marioidival*
> *Facebook*: *mario.idival*
> *User Linux** : **#554446*
>
> 2015-03-04 14:52 GMT-03:00 Chris McDonough <[email protected]>:
>
> On 03/04/2015 11:03 AM, Jonathan Vanasco wrote:
>>
>>>
>>>
>>> On Wednesday, March 4, 2015 at 10:30:44 AM UTC-5, Oliver Berger wrote:
>>>
>>>     If you want the same view executed for several urls just decorate it
>>>     twice with a different route...
>>>
>>>
>>> +1
>>>
>>> That's what most people would do.
>>>
>>> it would look something like this:
>>>
>>>      config.add_route ('test_index', '/ test /')
>>>      config.add_route ('test_focus', '/ test / {test_id}')
>>>
>>>       class MyViews(object):
>>>          @view_config("test_index")
>>>          @view_config("test_focus")
>>>          def test_unified(self):
>>>               pass
>>>
>>
>>
>> To be pedantic...
>>
>>        class MyViews(object):
>>           @view_config(route_name="test_index")
>>           @view_config(route_name="test_focus")
>>           def test_unified(self):
>>                pass
>>
>> (requires 'route_name=' keyword arg to work properly).
>>
>> - C
>>
>>
>>
>>
>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "pylons-discuss" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected]
>>> <mailto:[email protected]>.
>>> To post to this group, send email to [email protected]
>>> <mailto:[email protected]>.
>>> Visit this group at http://groups.google.com/group/pylons-discuss.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "pylons-discuss" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> Visit this group at http://groups.google.com/group/pylons-discuss.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/d/optout.

Reply via email to