#2158: Do not override the response content-type if it has already been
modified.
-------------------------+--------------------------------------------------
Reporter: amcgregor | Owner: percious
Type: enhancement | Status: new
Priority: normal | Milestone: 2.0b4
Component: TurboGears | Version: trunk
Severity: normal | Keywords:
-------------------------+--------------------------------------------------
Currently there is a hack of a string constant used to prevent TG2 from
altering the returned content-type.
{{{
#!python
# from tg.controllers
# If someone goes @expose(content_type=CUSTOM_CONTENT_TYPE) then we won't
override pylons.request.content_type
CUSTOM_CONTENT_TYPE = 'CUSTOM/LEAVE'
}}}
This is a hideous hack. Instead, TG2 should detect changes to the
content-type. By default it is configured as `text/html`. TG2 should not
modify it if its value differs from this default, allowing controllers to
override the content-type in the dynamic and Pylon-esque way:
{{{
#!python
@expose()
def download(self):
response.content_type = self.mime
response.content_disposition = 'attachment; filename="%s"' % self.name
return self.data
}}}
--
Ticket URL: <http://trac.turbogears.org/ticket/2158>
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
-~----------~----~----~----~------~----~------~--~---