Forum OpenACS Q&A: Re: Squirting out CSV files

Collapse
Posted by Jason B. Standing on
Hiya all,

I've been playing with this on and off, and template::list::write_csv does 
*almost* what I want, however it seems that inside it returns its results
with 

   ns_return 200 text/plain $__output

what I need is either that output sent back into a string variable so I can
do something with it, or to have a function identical to
template::list::write_csv that returns with something like

   set headers [ns_set new myheaders]
   ns_set put $headers "Content-disposition" \
      "attachment; filename=$output_file_name"
   ns_respond -status 200 \
      -type $mime_type \
      -string $__output \
      -headers $headers

in place of the ns_return statement that currently exists there.

Does anyone know of a function that already does what I want, or will this
have to be a change to the copy of list-procs.tcl that we're using ?

Cheers,

Jason