Ticket #1971 (closed enhancement: migrated)
Improve determination of content type in view.base.render
|Reported by:||Chris Arndt||Owned by:||anonymous|
|Severity:||normal||Keywords:||rendering, view, content type|
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 #1878.
- Keywords rendering, view, content type added
- Summary changed from Improve detrmination of content type in view.base.render to Improve determination of content type in view.base.render