[jifty-devel] Downloading files

Jesse Vincent jesse at bestpractical.com
Tue Dec 12 11:05:23 EST 2006




On Tue, Dec 12, 2006 at 09:22:14AM -0500, Henry Baragar wrote:
> Hello all,
> 
> What is the standard way to download a file in Jifty?  I am generating CSV 
> files from a database for downloading into spreadsheets.
> 
> The way I would do it in Mason would be to put the following in a template 
> file:
> 
> <%init>
>     use Apache::Constants qw/OK/;
>     $m->clear_buffer;
>     $r->content_type('text/comma-separated-values');
>     $r->send_http_header();
>     $m->print(csv_data());
>     $m->abort(OK);
> </%init>
> 
> It occurs to me that this should all go into the Dispatcher.  However, I am 
> worried that manipulating the request and Mason objects in this way will 
> interfere with what Jifty does.


Well, I wouldn't generally put print statements in the dispatcher ;)

Usually, I dispatch to a template that looks a lot like what you wrote,
except I've never needed the Apache::Constants, clear_buffer or
send_http_header lines ;)

> 
> Furthermore, there ought to be an easier way to do it!-)
> 
> Thanks,
> Henry
> _______________________________________________
> jifty-devel mailing list
> jifty-devel at lists.jifty.org
> http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel
> 

-- 


More information about the jifty-devel mailing list