Back to index

plone3  3.1.7
file_download_version.py
Go to the documentation of this file.
00001 ## Script (Python) "file_download_version"
00002 ##bind container=container
00003 ##bind context=context
00004 ##bind namespace=
00005 ##bind script=script
00006 ##bind subpath=traverse_subpath
00007 ##parameters=version_id=1
00008 ##title=File download version
00009 ##
00010 request = container.REQUEST
00011 RESPONSE =  request.RESPONSE
00012 
00013 obj = context.portal_repository.retrieve(context, version_id).object
00014 RESPONSE.setHeader('Content-Type', obj.getContentType())
00015 RESPONSE.setHeader('Content-Length', obj.get_size())
00016 RESPONSE.setHeader('Content-Disposition',
00017                    'attachment;filename=%s'%(obj.getId()))
00018 
00019 return obj.data