def createZIP(self, startdate, enddate):
""" Create the XTG file and the photos in a ZIP file """
from StringIO import StringIO
xtgString = StringIO()
photofiles = []
zorionagurrak = self.getZorionAgurrak(startdate, enddate)
xtgString.write('<v6.50><e0>\r')
for zorionagurra in zorionagurrak:
a = self.createZorionAgurraXTG(zorionagurra).getvalue()
xtgString.write(a)
photofiles.append((zorionagurra['id'], zorionagurra['photo']))
zipfile = self.appendFiles(xtgString, photofiles)
request = self.request
request.response.setHeader('Content-Type', 'application/zip')
request.response.setHeader('Content-Disposition', 'attachment; filename=zorionagurrak.zip')
request.response.write(zipfile.getvalue())
return request.response
You need to create an account or log in to post comments to this site.