I see. I guess it just seemed odd to me not to have a default behavior 
where a route would be matched automatically to the appropriately named 
class/function, but I guess that makes Pyramid a more flexible platform. 
Thank you.

On Tuesday, April 3, 2012 8:30:52 AM UTC-5, Michael Merickel wrote:
>
> Well you can certainly do it yourself with the "add_my_route" function 
> that you create that calls both for you... Otherwise, no, it's by design in 
> Pyramid that routes and views are separate concepts.
>
> You can always use traversal, and then it's just a single add_view call 
> with no add_route. :-)
>
> On Tue, Apr 3, 2012 at 6:52 AM, Zak wrote:
>
>> I want to map a route to a class-based view without needing to name the 
>> class again in a view-config decorator and without needing to explicitly 
>> name it in a config.add_view in the __init__. 
>>
>> I want 
>>
>> config.add_route('MyClass', '/')
>>
>> to map that route to 
>>
>> @view_defaults(renderer='string')
>> class MyClass(object):
>>     def __init__(self, request):
>>         self.request = request
>>
>>     def __call__(self):
>>         return 'a string'
>>
>> without needing any extra code. Is this possible?
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "pylons-discuss" group.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msg/pylons-discuss/-/LSh9cGEFUJkJ.
>> 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.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/pylons-discuss/-/0bLiBHjriP8J.
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