[Product-Developers] Dynamic downloads

Eric Bréhault ebrehault at gmail.com
Tue Aug 12 13:48:26 UTC 2008


Hello,

in the method implementing your action, you just need to set the
correct http header like this:
def doAction(self, REQUEST):
            REQUEST.response.setHeader('Content-type','text/csv;charset='+encoding)
            REQUEST.response.setHeader('Content-Disposition',
"attachment; filename=export.csv")
            return your_csv_content

note: to produce CSV, use the csv python module

Eric

On Tue, Aug 12, 2008 at 3:13 PM, cswank <craig_swank at nrel.gov> wrote:
>
> Hello,
> I would like to have a document_action link that calls a method which
> generates a .csv file that is downloaded to the user's computer.  I've been
> looking all around, but can't find a way do do this.  Can anyone point me in
> the right direction?  I already have figured out how to make the
> document_action, so I just need to give it this functionality.
>
> Thanks,
>
> Craig
> --
> View this message in context: http://n2.nabble.com/Dynamic-downloads-tp714294p714294.html
> Sent from the Product Developers mailing list archive at Nabble.com.
>
>
> _______________________________________________
> Product-Developers mailing list
> Product-Developers at lists.plone.org
> http://lists.plone.org/mailman/listinfo/product-developers
>




More information about the Product-Developers mailing list