Quantcast
Channel: Planet Plone - Where Developers And Integrators Write
Viewing all articles
Browse latest Browse all 3535

UW Oshkosh How-To's: How to allow downloading of PloneFormGen saved data

$
0
0

In older Plone 3.1.x sites with PloneFormGen 1.6.7 it is finicky to allow someone other than the form creator to download the form's saved data, even if you go into the save data adapter's ZMI Security tab and try to grant 'PloneFormGen: Download Saved Input' to roles like Reader.

To get around that, in the form folder go to the ZMI (append /manage_main to the PFG form's URL) then add a Script (Python).  Call it download_tsv and in the body put:

request = container.REQUEST
RESPONSE =  request.RESPONSE

data = context['saved-data']
return data.download_tsv(request, RESPONSE)
 

Then provide the user with the URL of that script, e.g. 

http://www.yoursite.edu/division/request-form/download_tsv

That link will still require that the person log in, but if you granted "can read" to that person (or to a group that the person is a member of) via the form's Sharing tab, they will be able to get the tab-separated-values file directly from their browser, which they can either save locally or open with an application.


Viewing all articles
Browse latest Browse all 3535

Trending Articles