On Sep 22, 8:06 pm, Jonathan Vanasco <[email protected]> wrote:
> by default it sets response.content_type to "application/json"
>
> is there a way to override this?
Looking at the way the decorator is written, you can just set
`response.content_type` in your controller action. This works because
the the decorator sets the (thread/request-local) response's content
type and *then* calls your controller action, so whatever you do to
the response in your action will override the decorator.
def my_action(self):
# ...
response.content_type = 'text/javascript' # <-- @jsonify already
set the content type header, so this will override it
return my_data_structure
> if not , could I request this in a future version of pylons ?
>
> though testing, i discovered that a lot of browsers will 'download'
> application/json files if you hit them directly -- ie, they won't
> render in the browser, they'll just save to disk.
>
> the same browsers will render "text/javascript" files fine.
>
> i've got some custom code that lets me dev stuff, but something built
> into pylons would probably be useful for others.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---