Thanks, it worked. It looks ugly but at least it works. I will have to run 
some test on it to see if the sort order is stable...

     @view_config(route_name='overview', 
                  accept='application/json', 
                  renderer='grid-data') 
     @view_config(route_name='overview', 
                  accept="a",
                  renderer='overview.mak') 
     def overview(self): 
         return dict(grid=OverviewGrid(self.request)) 

On Tuesday, August 14, 2012 4:00:38 PM UTC+2, Mattias wrote:
>
> Unfortunately WebOb matches "application/json" with the last "*/*" of the 
> browsers accept string. I wonder if I could use 
> @view_config(route_name="foo" accept="a") or something that always would 
> end up as the best match of '*/*'. I will have to try that. 
>
> On Tuesday, August 14, 2012 3:49:07 PM UTC+2, Gael Pasgrimaud wrote:
>>
>> > This almost does what I want. 
>> >      @view_config(route_name='overview', 
>> >                   accept="text/html", 
>> >                   renderer='overview.mak') 
>> >      @view_config(route_name='overview', 
>> >                   accept='application/json', 
>> >                   renderer='grid-data') 
>> >      def overview(self): 
>> >          return dict(grid=OverviewGrid(self.request)) 
>>
>> What about: 
>>
>>      @view_config(route_name='overview', 
>>                   accept='application/json', 
>>                   renderer='grid-data') 
>>      @view_config(route_name='overview', 
>>                   renderer='overview.mak') 
>>      def overview(self): 
>>          return dict(grid=OverviewGrid(self.request)) 
>>
>> I guess that if the first one doesn't match then the second is used. 
>>
>>
>>

-- 
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/-/2hQ-JiZkgdcJ.
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