Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #1971 (closed enhancement: migrated)

Opened 6 years ago

Last modified 4 years ago

Improve determination of content type in view.base.render

Reported by: Chris Arndt Owned by: anonymous
Priority: normal Milestone: 1.1.x bugfix
Component: TurboGears Version: 1.0.6
Severity: normal Keywords: rendering, view, content type
Cc:

Description

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.

Change History

comment:1 Changed 6 years ago by Chris Arndt

  • 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

comment:2 Changed 6 years ago by Chris Arndt

See also comment no. 5 from #1963.

comment:3 Changed 6 years ago by faide

  • Milestone changed from 1.1 to 1.1 maintenance

comment:4 Changed 4 years ago by chrisz

  • Status changed from new to closed
  • Resolution set to migrated
Note: See TracTickets for help on using tickets.