--- cdli/cdli_files.py 2009/06/24 11:13:47 1.112 +++ cdli/cdli_files.py 2009/08/31 14:06:42 1.113 @@ -801,13 +801,34 @@ class CDLIRoot(Folder): if isinstance(fileId,CDLIFileObject): # support for old baskets return fileId x=self.v_files.get(fileId) - + logging.debug("obj: "+repr(x)) + if x==None: + folder=fileId[0:3] + f2=fileId[0:5] + fObj = getattr(self.cdliRoot.cdli_main,folder); + f2Obj = getattr(fObj,f2) + + o = getattr(f2Obj,fileId) + logging.debug(o); + self.updateOrAddToFileBTree(o) + return o return x def getFileObjectLastVersion(self,fileId): """get an object""" x=self.v_files_lastVersion.get(fileId) - #logging.debug("lastVersion: "+repr(x)) + logging.debug("lastVersion: "+repr(x)) + if x==None: + folder=fileId[0:3] + f2=fileId[0:5] + fObj = getattr(self.cdliRoot.cdli_main,folder); + f2Obj = getattr(fObj,f2) + + o =getattr(f2Obj,fileId) + logging.debug(o); + return o.getLastVersion() + + return x def showFileIds(self): @@ -1349,7 +1370,15 @@ class CDLIRoot(Folder): try: self.cdliRoot.updateOrAddToFileBTree(ob[0].getObject()) except: + logging.error("uploadATFfinally - cannot update Object %s Error: %s %s"%(ob[1],sys.exc_info()[0],sys.exc_info()[1])) + for x in stObj.returnValue['newPs']: + ob=self.CDLICatalog.search({'title':x}) + try: + self.cdliRoot.updateOrAddToFileBTree(ob[0].getObject()) + except: + + logging.error("uploadATFfinally - cannot update Object %s Error: %s %s"%(x,sys.exc_info()[0],sys.exc_info()[1])) if RESPONSE is not None: RESPONSE.redirect(self.absolute_url()) @@ -1396,17 +1425,21 @@ class CDLIRoot(Folder): id=f logging.debug("importFiles: addCDLIFile fobj2=%s, f=%s file2=%s"%(fobj2,repr(f),repr(file2))) fobj2.addFile(vC='',file=file(file2),author=author,newName=f) + logging.debug("importfiles: fobj2.add") count+=1 #now add the file to the storage ob = getattr(fobj2,f) - self.cdliRoot.updateOrAddToFileBTree(ob) - + logging.debug("importfiles: btree_start") + #self.cdliRoot.updateOrAddToFileBTree(ob) + logging.debug("importfiles: btree_end") if count%100==0: logging.debug("importfiles: committing") transaction.get().commit() + logging.debug("importfiles: committing") transaction.get().commit() + logging.debug("importfiles: committing done") return "ok"