#2263: Custom Content Type document needs to be fixed.
---------------------------+------------------------------------------------
Reporter: AZMel | Owner:
Type: defect | Status: new
Priority: normal | Milestone: 2.0rc1
Component: Documentation | Version: 2.0b7
Severity: normal | Keywords:
---------------------------+------------------------------------------------
The document at http://turbogears.org/2.0/docs/main/ResponseTypes.html
shows
{{{
import pylons
from tg.controllers import CUSTOM_CONTENT_TYPE
class MyController:
@expose(content_type=CUSTOM_CONTENT_TYPE)
def stats(self):
pylons.request['Content-Type'] = 'text/csv'
pylons.request['Content-Disposition'] =
'attachment;filename=stats.csv'
return '1,2,3'
}}}
In the Custom Content Type section:
{{{
pylons.request['Content-Type'] = 'text/csv'
pylons.request['Content-Disposition'] =
'attachment;filename=stats.csv'
}}}
should be replaced with:
{{{
pylons.response.headers['Content-Type'] = 'text/csv'
pylons.response.headers['Content-Disposition'] =
'attachment;filename=stats.csv'
}}}
and possibly a note that 'text/csv' may need to be 'text/csv;
charset=utf-8' for unicode.
--
Ticket URL: <http://trac.turbogears.org/ticket/2263>
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
-~----------~----~----~----~------~----~------~--~---