version 1.1, 2006/10/04 07:35:27
|
version 1.5, 2007/06/25 11:05:03
|
Line 1
|
Line 1
|
|
"""actual version of the versioned file folder with external filestorage, |
|
using the ExtFile Product, this version replaces externaVersionedFile.py |
|
DW 11.10.2006 |
|
""" |
|
|
from OFS.Folder import Folder |
from OFS.Folder import Folder |
from OFS.Image import File |
from OFS.Image import File |
from OFS.Image import cookId |
from OFS.Image import cookId |
Line 17 try:
|
Line 22 try:
|
except: |
except: |
print "no images" |
print "no images" |
|
|
|
|
from threading import Thread |
from threading import Thread |
import shutil |
import shutil |
import tempfile |
import tempfile |
import os.path |
import os.path |
import urllib |
import urllib |
|
|
import time |
import time |
|
import logging |
|
|
try: |
try: |
from Products.ECHO_content.ECHO_collection import ECHO_basis |
from Products.ECHO_content.ECHO_collection import ECHO_basis |
except: |
except: |
Line 71 class generateDownloadZip:
|
Line 76 class generateDownloadZip:
|
|
|
savePath=os.path.join(tmpPath,lastV.title) |
savePath=os.path.join(tmpPath,lastV.title) |
fh=file(savePath,"w") |
fh=file(savePath,"w") |
fh.write(lastV.data) |
fh.write(lastV.getData()) |
fh.close() |
fh.close() |
|
|
self.response+="<h3>2. step: creating the downloadable file</h3>" |
self.response+="<h3>2. step: creating the downloadable file</h3>" |
Line 421 class extVersionedFileFolder(Folder,ECHO
|
Line 426 class extVersionedFileFolder(Folder,ECHO
|
|
|
|
|
def header_html(self): |
def header_html(self): |
"""zusätzlicher header""" |
"""zusaetzlicher header""" |
ext=self.ZopeFind(self,obj_ids=["header.html"]) |
ext=self.ZopeFind(self,obj_ids=["header.html"]) |
if ext: |
if ext: |
return ext[0][1]() |
return ext[0][1]() |
Line 472 class extVersionedFileFolder(Folder,ECHO
|
Line 477 class extVersionedFileFolder(Folder,ECHO
|
ob.title=id |
ob.title=id |
file2=file |
file2=file |
|
|
obj=ob.manage_addextVersionedFileObject(id,vC,author,file2,content_type=content_type) |
logging.info("ADD: %s"%repr(ob)) |
|
obj=ob.manage_addVersionedFileObject(id,vC,author,file2,content_type=content_type) |
self.REQUEST.SESSION['objID']=ob.getId() |
self.REQUEST.SESSION['objID']=ob.getId() |
self.REQUEST.SESSION['objID_parent']=None |
self.REQUEST.SESSION['objID_parent']=None |
|
|
Line 861 class extVersionedFile(CatalogAware,Fold
|
Line 867 class extVersionedFile(CatalogAware,Fold
|
def diff(self,data): |
def diff(self,data): |
"""differenz between lastversion and data""" |
"""differenz between lastversion and data""" |
d=Differ() |
d=Differ() |
tmp=self.getLastVersion().data |
tmp=self.getLastVersion().getData() |
#print "XX",data,tmp |
#print "XX",data,tmp |
try: |
try: |
l=list(d.compare(data.splitlines(1),tmp.splitlines(1))) |
l=list(d.compare(data.splitlines(1),tmp.splitlines(1))) |
Line 880 class extVersionedFile(CatalogAware,Fold
|
Line 886 class extVersionedFile(CatalogAware,Fold
|
security.declarePublic('index_html') |
security.declarePublic('index_html') |
def index_html(self): |
def index_html(self): |
"""main view""" |
"""main view""" |
lastVersion=self.getLastVersion() |
#lastVersion=self.getLastVersion() |
#return "File:"+self.title+" Version:%i"%lastVersion.versionNumber," modified:",lastVersion.bobobase_modification_time()," size:",lastVersion.getSize(),"modified by:",lastVersion.lastEditor() |
#return "File:"+self.title+" Version:%i"%lastVersion.versionNumber," modified:",lastVersion.bobobase_modification_time()," size:",lastVersion.getSize(),"modified by:",lastVersion.lastEditor() |
return "File: %s Version:%i modified:%s size:%s modified by:%s"%(self.title,lastVersion.versionNumber,lastVersion.getTime(),lastVersion.getSize(),lastVersion.lastEditor()) |
#return "File: %s Version:%i modified:%s size:%s modified by:%s"%(self.title,lastVersion.versionNumber,lastVersion.getTime(),lastVersion.getSize(),lastVersion.lastEditor()) |
|
return self.history() |
|
|
|
|
security.declarePublic('getVersion') |
security.declarePublic('getVersion') |