#7 Improve determination of content type in view.base.render

1.5.1
open
nobody
view (1)
core
enhancement
normal
2011-07-03
2011-03-11
No

This was ticket #1971 from the old Trac, reported by Chris Arndt:

In view.base.render the content type in the response headers is determined by looking at the output format. A source code comment says:

# We simply derive the content type from the format here
# and use the charset specified in the configuration setting.
# This could be improved by also examining the engine and the output.

A better solution would also handle the cases where format is XTMLSerializer, XMLSerializer or PlainSerializer instance and derive the proper content type.

  • Solution 1: TurboKid (and other engines) could provide an auxiliary function for deriving a proper content type from the format parameter. (TurboJson had a similar function for deriving the content type from the user agent, but this is not used any more).
  • Solution 2: Or, this auxiliary function could be put into tg.util. We already have a similar function get_template_encoding_default(enginename) there.

See also ticket #1878 and comment no. 5 from ticket #1963 in the old Trac.

Discussion


Anonymous


Cancel   Add attachments