--- versionedFile/extVersionedFile.py 2007/09/14 12:06:55 1.10 +++ versionedFile/extVersionedFile.py 2007/09/14 14:58:28 1.11 @@ -217,17 +217,33 @@ class extVersionedFileFolder(Folder,ECHO for (vfn, vf) in vff.getVersionedFiles(): if vf.meta_type == 'versionedFile': + logging.error("importvff: importing %s of type %s!"%(vfn,vf.meta_type)) title = vf.title - author = vf.author - vc = getattr(vf.comment, "") + fob = vf.getLastVersion() + author = fob.getLastEditor() + vc = fob.getVersionComment() # save file to filesystem savePath=os.path.join(tmpPath,title) fh=file(savePath,"w") - fh.write(lastV.getData()) + data = vf.getLastVersion().data + if isinstance(data, str): + # simple data object + fh.write(data) + else: + # chained data objects + while data is not None: + fh.write(data.data) + data = data.next fh.close() # and read in again fh = file(savePath) + logging.error("importvff: comment=%s author=%s!"%(vc,author)) self.addFile(vC=vc, file=fh, author=author) + # copy more fields + newfob = getattr(self, vfn).getContentObject() + newfob.vComment = fob.vComment + newfob.time = fob.time + logging.error("importvff: vc=%s time=%s of %s!"%(fob.vComment,fob.time,fob.getId())) else: logging.error("importvff: unable to import %s of type %s!"%(vfn,vf.meta_type)) @@ -492,7 +508,7 @@ class extVersionedFileFolder(Folder,ECHO else: id=newName - if not vC: + if vC is None: vC=self.REQUEST.form['vC'] # get new extVersionedFile