On 5/7/08, percious <[EMAIL PROTECTED]> wrote:
>
> cool, so after some minor digging into the tg2 code, i realized that
> @expose takes a content_type argument.
> Thus, my code becomes:
>
> >  @expose(content_type="application/csv")
> >  def export(self,  **kw):
> >         r = 'asdf,asdf,asdf'
> >         response = pylons.response
> >         response.headers['Content-Transfer-Encoding'] = 'Binary'
> >         response.headers['Content-length'] = len(r)
> >         response.headers['Content-Disposition'] = 'attachment;
> > filename=\"mygenerated.csv\"'
> >         response.headers['Connection'] = "close"
> >         return r
> >
>
> I wonder if it might be a good idea to look at the response headers
> inside _render_response to see if the content-type has not already
> been set???

+1

Haven't played with TG2 recently, but if it allows the controller to
choose dynamically the template wwhich will be used (as TG1 does), I
think the same should be applied to content-type.

Cheers,

Roger

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears Trunk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears-trunk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to