howto write download: Product.state --> client file
the product should be able to download its own state to the client file system. code in DTML: <b>Save to (client) file? (download)</b> <a href="<dtml-var "URL1">/manage_save_file"><b>download</b></a> code in manage_save_file: def manage_save_file(self, REQUEST=None): """save state to client file""" tmpFile = StringIO() tmpFile.write(repr(self.tabstree)) # now repr, pickle l8er tmpFile.close() fname = self.id + '.' + self.fsuffix # to give download a filename REQUEST.RESPONSE.setHeader('content-disposition', 'attachment; filename="%s" ' % (fname)) REQUEST.RESPONSE.setHeader('content-type', 'text/plain') if REQUEST is not None: return tmpFile what is wrong/missing & where could i retrieve the info (in lieu of asking)
participants (2)
-
Chris Withers -
hans