## Script (Python) "download_errors"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=
##title=
##
# $Id: download_errors.py 3326 2008-03-12 22:28:34Z henrik $
"""
export xxx.errors
"""
try:
    from Products.zdb import set_trace
except:
    def set_trace():
        pass
request = context.REQUEST
setheader = request.RESPONSE.setHeader
#set_trace()
data = context.getContent()['getErrors']()
filename = context.getId().replace('.csv','_errors.csv')
#setheader('Content-type', 'text/x-cvs')
#setheader('Content-type','application/vnd.ms-excel')
setheader('Content-type','text/semicolon-seperated-values')
setheader('Content-Disposition:', 'attachment; filename=%s' % filename)
setheader('Expires',  'Mon, 26 Jul 1997 05:00:00GMT') # Date in the past
setheader('Cache-Control', 'no-store, no-cache,must-revalidate') # HTTP/1.1
setheader('Cache-Control', 'post-check=0,pre-check=0')
#setheader('Pragma', 'no-cache') # HTTP/1.0
return data
