You are here: Home / Documentation / How To's / How to allow downloading of PloneFormGen saved data

How to allow downloading of PloneFormGen saved data

by nguyen — published Aug 14, 2014 03:25 PM, last modified Aug 16, 2016 10:50 AM
getting around permission issues

PloneFormGen 1.6.7 and up provides a control panel in Site Setup that lets you control who can download saved data.  By default, Manager, Owner, and Site Administrator are allowed to download saved data but you can check boxes for other roles, such as Editor, Reader, Member.

The following method completely bypasses those permission checks.

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.

Navigation