version 1.8, 2007/09/10 17:40:37
|
version 1.9, 2007/09/10 19:27:55
|
Line 29 import os.path
|
Line 29 import os.path
|
import urllib |
import urllib |
import time |
import time |
import logging |
import logging |
|
import types |
|
|
try: |
try: |
from Products.ECHO_content.ECHO_collection import ECHO_basis |
from Products.ECHO_content.ECHO_collection import ECHO_basis |
Line 433 class extVersionedFileFolder(Folder,ECHO
|
Line 434 class extVersionedFileFolder(Folder,ECHO
|
|
|
def addFile(self,vC,file,author='',newName='',content_type='',RESPONSE=None): |
def addFile(self,vC,file,author='',newName='',content_type='',RESPONSE=None): |
""" add a new file""" |
""" add a new file""" |
|
# is file is a real file or a zope download object? |
|
isRealFile = type(file) is types.FileType |
|
|
if newName=='': |
if newName=='': |
|
logging.debug("fileobject: %s real:%s"%(repr(file),repr(isRealFile))) |
|
if isRealFile: |
|
filename = file.name |
|
else: |
filename=file.filename |
filename=file.filename |
|
|
id=filename[max(filename.rfind('/'), |
id=filename[max(filename.rfind('/'), |
filename.rfind('\\'), |
filename.rfind('\\'), |
filename.rfind(':'), |
filename.rfind(':'), |
Line 443 class extVersionedFileFolder(Folder,ECHO
|
Line 452 class extVersionedFileFolder(Folder,ECHO
|
else: |
else: |
id=newName |
id=newName |
|
|
|
if not vC: |
vC=self.REQUEST.form['vC'] |
vC=self.REQUEST.form['vC'] |
|
|
# get new extVersionedFile |
# get new extVersionedFile |
Line 450 class extVersionedFileFolder(Folder,ECHO
|
Line 460 class extVersionedFileFolder(Folder,ECHO
|
#if (getattr(self,'commentNonEmpty',0)==1) and vC.strip()=="": |
#if (getattr(self,'commentNonEmpty',0)==1) and vC.strip()=="": |
# add file to this folder |
# add file to this folder |
self._setObject(id,vf) |
self._setObject(id,vf) |
file2=file |
|
# add its content |
# add its content |
logging.info("ADD: %s"%repr(vf)) |
logging.info("ADD: %s"%repr(vf)) |
obj=vf.addContentObject(id,vC,author=author,file=file2,content_type=content_type) |
obj=vf.addContentObject(id,vC,author=author,file=file,content_type=content_type,from_tmp=isRealFile) |
|
|
self.REQUEST.SESSION['objID']=vf.getId() |
self.REQUEST.SESSION['objID']=vf.getId() |
self.REQUEST.SESSION['objID_parent']=None |
self.REQUEST.SESSION['objID_parent']=None |
Line 462 class extVersionedFileFolder(Folder,ECHO
|
Line 471 class extVersionedFileFolder(Folder,ECHO
|
pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','errorUploadFile')).__of__(self) |
pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','errorUploadFile')).__of__(self) |
return pt() |
return pt() |
|
|
|
if RESPONSE is not None: |
RESPONSE.redirect(self.REQUEST['URL1']) |
RESPONSE.redirect(self.REQUEST['URL1']) |
|
|
|
|
Line 1002 class extVersionedFile(CatalogAware,Fold
|
Line 1012 class extVersionedFile(CatalogAware,Fold
|
self.lastVersionNumber = versNum |
self.lastVersionNumber = versNum |
self.lastVersionId = id |
self.lastVersionId = id |
|
|
logging.debug("addcontentobject: lastversion=%s"%self.getData()) |
#logging.debug("addcontentobject: lastversion=%s"%self.getData()) |
logging.debug("reindex1: %s in %s"%(repr(self),repr(self.default_catalog))) |
logging.debug("reindex1: %s in %s"%(repr(self),repr(self.default_catalog))) |
self.reindex_object() |
self.reindex_object() |
logging.debug("addcontentobject: fob_data=%s"%fob.getData()) |
#logging.debug("addcontentobject: fob_data=%s"%fob.getData()) |
|
|
return fob |
return fob |
|
|