#2378: General content_type ticket.
--------------------------+-------------------------------------------------
 Reporter:  jorge.vargas  |       Owner:            
     Type:  defect        |      Status:  new       
 Priority:  high          |   Milestone:  2.* bugfix
Component:  TurboGears    |     Version:  trunk     
 Severity:  normal        |    Keywords:            
--------------------------+-------------------------------------------------
 This is a catchall titcket for #2158 and #2280 as each solution breaks it
 the other way.

 #2280 explains that @expose(content_type="foo/bar') should be the "default
 way" of doing this. This is the current behavior in both 2.0.x and 2.1.x.

 However #2263 raises the issue of modifying the content type "at runtime"
 in the case the pylons way of doing it does not work therefore we are
 using a flag (CUSTOM_CONTENT_TYPE) to prevent it being overwritten. The
 underlying problem regarding this is under investigation, but it appears
 to be a trashing of the response object, therefore the correct code:

 {{{
     @expose()
     def stats(self):
         pylons.request['Content-Type'] = 'text/csv'
         return '1,2,3'
 }}}

 Does not work with 2.x and the corresponding must be used:

 {{{
     @expose(content_type=CUSTOM_CONTENT_TYPE)
     def stats(self):
         pylons.request['Content-Type'] = 'text/csv'
         return '1,2,3'

 }}}

-- 
Ticket URL: <http://trac.turbogears.org/ticket/2378>
TurboGears <http://www.turbogears.org/>
TurboGears front-to-back web development

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "TurboGears Tickets" group.
This group is read-only. No posting by normal members allowed.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/turbogears-tickets?hl=en?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to