this is really great, thank you!!

i don't know if you wrote an @jsonp renderer, but I adapted yours...


def jsonp_renderer_factory(info):
    def _render(value, system):
        value = py2json(value)
        request = system.get('request')
        if request is None:
            return value
        # JSONP is GET only, unless you do some weird shit that
doesn't work reliably
        callback = request.GET.get('callback',None)
        if callback is None:
            ct_json = 'application/json'
        else:
            ct_json = 'application/javascript'
            value = '%s(%s)' % (callback, value)
        response = request.response
        if response.content_type == response.default_content_type :
            response.content_type = ct_json
        return value
    return _render

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to