Adding

$this->getResponse()->setContentType('text/csv');

and then later

return sfView::NONE;

does seem to solve the issue, however, I am still unclear why the
ContentType header is not being set properly coming from my app's
factories.yml file.

On Apr 30, 8:20 am, DEE <jasond...@gmail.com> wrote:
> 'csv' is not a supported default :sf_format within symfony's core, and
> this is a contenttype I wanted to serve up from a route with a default
> 'html' format.
>
> http://www.symfony-project.org/blog/2008/06/09/how-to-create-an-optim...
>
> Going by what is contained in lib/vendor/symfony/lib/config/config/
> factories.yml (which in 1.4.4 is identical to the above old blog
> post), I added the following to my app's factories.yml:
>
> http://paste2.org/p/802320
>
> My route is setup properly to support 'csv', and is even set as the
> default format for the route
>
> http://paste2.org/p/802326
>
> Within my action, $this->getRequest()->getRequestFormat() properly
> does return 'csv'. I don't actually want to use some
> resultsFavoriteSuccess.csv.php file, so instead I have done
>
> $this->renderText('the contents of the .csv file');
> return sfView::NONE;
>
> The issue I'm having is, with the above code, the debug toolbar still
> appears (there is no actual layout displayed though). Further, when
> viewing the HTTP response headers, it is showing the content-type as
> text/html still, and not my desired text/csv.
>
> I should mention, I am NOT explicitly sending a content-type: text/csv
> header within the action - from my understanding, my factories.yml
> config addition should take care of this for me.
>
> 1. Have I setup the request config for the 'csv' sf_format incorrectly
> in my app's factories.yml?
> 2. Am I doing something wrong with renderText() and sfView::NONE, as
> shown above, causing the text/html header?
>
> Thanks for any help.
>
> --
> If you want to report a vulnerability issue on symfony, please send it to 
> security at symfony-project.com
>
> You received this message because you are subscribed to the Google
> Groups "symfony users" group.
> To post to this group, send email to symfony-users@googlegroups.com
> To unsubscribe from this group, send email to
> symfony-users+unsubscr...@googlegroups.com
> For more options, visit this group 
> athttp://groups.google.com/group/symfony-users?hl=en

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to