Hello again, Eric,
I guess there is something I don't understand about actions. Here is
the xml that defines the action for my content type's profile:
<action title="Download CSV" action_id="download-csv"
category="document_actions" condition_expr=""
url_expr="string:${object_url}/exportIdSheet" visible="True">
<permission value="Modify portal content" />
</action>
so I made a method in my content called exportIdSheet(self, REQUEST),
but when I click on the link that is generated from the xml above, it
says the page doesn't exist. Is there something I'm doing wrong?
Craig
On Aug 12, 2008, at 7:48 AM, Eric Bréhault wrote:
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 <[EMAIL PROTECTED]> 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
[email protected]
http://lists.plone.org/mailman/listinfo/product-developers
_______________________________________________
Product-Developers mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/product-developers