--- versionedFile/versionedFile.py 2005/08/15 09:48:35 1.42 +++ versionedFile/versionedFile.py 2005/10/19 13:41:59 1.49 @@ -8,13 +8,16 @@ from AccessControl import getSecurityMan from Products.PageTemplates.PageTemplate import PageTemplate from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate from AccessControl import ClassSecurityInfo -from Products.ImageArchive.ImageArchive import manage_AddImageZogiLib +try: + from Products.ImageArchive.ImageArchive import manage_AddImageZogiLib +except: + print "no images" from threading import Thread import shutil import tempfile import os.path - +import urllib import time try: @@ -512,17 +515,25 @@ class versionedFileObject(File): - def download(self): + def download(self,REQUEST=None,RESPONSE=None): """download and lock""" self.REQUEST.RESPONSE.setHeader("Content-Disposition","""attachement; filename=%s"""%self.getId()) - self.REQUEST.RESPONSE.setHeader("Content-Type","application/octet-stream") - + self.REQUEST.RESPONSE.setHeader("Content-Type","application/octet-stream") + #try: + # txt=self.index_html() + #except: + # txt=self.index_html(REQUEST,RESPONSE) + # + #self.REQUEST.RESPONSE.setHeader("Content-Length","str(len(txt)+1000)") + self.content_type="application/octet-stream" - #self.REQUEST.RESPONSE.redirect(self.absolute_url()) - self.REQUEST.RESPONSE.write(self.index_html()) - #self.REQUEST.RESPONSE.write("bl") - self.REQUEST.close() + self.REQUEST.RESPONSE.redirect(self.absolute_url()) + #txt=urllib.urlopen(self.absolute_url()).read() + #self.REQUEST.RESPONSE.write(txt) + + + #self.REQUEST.close() def downloadLocked(self): """download and lock""" @@ -825,15 +836,22 @@ class versionedFile(Folder): """download and lock""" self.REQUEST.RESPONSE.setHeader("Content-Disposition","""attachement; filename=%s"""%self.getLastVersion().getId()) - self.REQUEST.RESPONSE.setHeader("Content-Type","application/octet-stream") + self.REQUEST.RESPONSE.setHeader("Content-Type","application/octet-stream") + #try: + # txt=self.getLastVersion.index_html() + #except: + # txt=self.getLastVersion.index_html(REQUEST,RESPONSE) + + #self.REQUEST.RESPONSE.setHeader("Content-Length","str(len(txt)+1000)") + self.content_type="application/octet-stream" #self.REQUEST.RESPONSE.write("bl") - self.REQUEST.RESPONSE.write(self.getLastVersion().index_html()) - self.REQUEST.close() + #self.REQUEST.RESPONSE.write(txt) + #self.REQUEST.close() #self.getLastVersion().content_type="application/octet-stream" - #self.REQUEST.RESPONSE.redirect(self.REQUEST['URL1']+'/'+self.getId()+'/'+self.getLastVersion().getId()) + self.REQUEST.RESPONSE.redirect(self.REQUEST['URL1']+'/'+self.getId()+'/'+self.getLastVersion().getId()) def downloadLocked(self): """download and lock"""