On Thu, Sep 24, 2009 at 11:38 AM, Wyatt Baldwin
<[email protected]> wrote:
>
> On Sep 24, 10:09 am, Jonathan Vanasco <[email protected]> wrote:
>> > Jsonify is only ten lines or so.  You can copy it and add this
>> > feature.  It's too specific for Pylons though.  (What would the config
>> > variable be, 'jsonify_content_type'?)
>>
>> I disagree that its too specific.  It's a change that would make it
>> easier for developers to test jsonify content in their browser,
>> without having to use firefox with a special plugin -- which is what
>> people currently have to do.  I think making things easier for a
>> general audience of Pylons developers to code & test is good.
>>
>> I don't need this personally.  I use a library function to create
>> structured dicts that are turned into JSON , and put this
>> functionality in there.  But I do think it is of benefit to others.
>>
>> And yes, I was thinking of a change like this :
>>
>> -    pylons.response.headers['Content-Type'] = 'application/json'
>>
>> +    if 'pylons.jsonify_content_type' in pylons.config:
>> +        pylons.response.headers['Content-Type'] = pylons.config
>> ['pylons.jsonify_content_type']
>> +    else:
>> +        pylons.response.headers['Content-Type'] = 'application/json'
>
> I'm -0 on this idea, but if it goes in, I'd prefer this
> implementation:
>
>  -    pylons.response.headers['Content-Type'] = 'application/json'
>  +   pylons.response.content_type = config.get('json_content_type',
> 'application/json')
>
> I don't think the JSONView Firefox add-on qualifies as particularly
> "special", and the formatting & colorization is very nice. When I've
> viewed JSON as text in the browser, it's been nearly unreadable
> because it was all squished together & didn't wrap.

response.content_type is translated to
response.headers['content-type'] so they're the same (except that I
forget the property exist).  I don't see how either way addresses
wrapping, although I think simplejson has an argument to pretty-format
which we could enable.

-- 
Mike Orr <[email protected]>

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