--- cdli/cdli_files.py 2007/02/05 16:20:38 1.64 +++ cdli/cdli_files.py 2007/02/08 10:46:36 1.65 @@ -213,7 +213,7 @@ class uploadATFfinallyThread(Thread): uploadFns=[] #do first the changed files - i=0 + i=0 for fn in uploadFns: i+=1 founds=ctx2.CDLICatalog.search({'title':fn}) @@ -225,41 +225,52 @@ class uploadATFfinallyThread(Thread): i=0 transaction.get().commit() logging.info("changing: do commit") - transaction.get().commit() - logging.info("changing: last commit") + + transaction.get().commit() + logging.info("changing: last commit") #now add the new files newPs=SESSION['newPs'] if len(newPs)>0: tmpDir=SESSION['tmpdir'] + logging.info("adding start") self.result="

Adding files

"+self.result #TODO: make this configurable, at the moment base folder for the files has to be cdli_main ctx2.importFiles(comment=comment,author=str(username) ,folderName=tmpDir, files=newPs,ext=self) - + logging.info("adding finished") #unlock locked files? if unlock: + logging.info("unlocking start") self.result="

Unlock files

"+self.result unlockFns=[] for x in os.listdir(SESSION['tmpdir']): if not x in SESSION['errors']: unlockFns.append(x) - + logging.info("unlocking have now what to unlock") + for fn in unlockFns: + #logging.info("will unlock: %s"%fn) founds=ctx2.CDLICatalog.search({'title':fn}) + #logging.info("found it: %s"%repr(founds)) if len(founds)>0: + #logging.info("unlock: %s"%founds[0].getObject().getId()) SESSION['author']=str(username) founds[0].getObject().lockedBy="" + logging.info("unlocking done") - #if a basketname is give, add files to the basket + #if a basketname is given, add files to the basket if not (basketname ==''): - self.result="

Add basket

"+self.result + logging.info("add to basket %s"%basketname) + self.result="

Add to basket

"+self.result basketId=ctx2.basketContainer.getBasketIdfromName(basketname) if not basketId: # create new basket + logging.info("create basket %s"%basketname) + self.result="

Create a new basket

"+self.result ob=ctx2.basketContainer.addBasket(basketname) basketId=ob.getId() basket=getattr(ctx2.basketContainer,str(basketId)) @@ -270,7 +281,7 @@ class uploadATFfinallyThread(Thread): RESPONSE.redirect(self.aq_parent.absolute_url()) - + logging.info("uploadfinally done") return True class tmpStore(SimpleItem): @@ -832,7 +843,7 @@ class CDLIBasket(Folder,CatalogAware): def addObjects(self,ids,deleteOld=None,username=None): """generate a new version of the basket with objects added""" - + logging.info("add to basket (%s)"%(self.getId())) lastVersion=self.getLastVersion() if lastVersion is None: @@ -846,10 +857,11 @@ class CDLIBasket(Folder,CatalogAware): newContent=[] added=0 for id in ids: - try: - founds=self.CDLICatalog.search({'title':id}) - except: - founds=[] + try: + founds=self.CDLICatalog.search({'title':id}) + except: + founds=[] + for found in founds: if found.getObject() not in oldContent: #TODO: was passiert wenn, man eine Object dazufŸgt, das schon da ist aber eine neuere version @@ -863,7 +875,7 @@ class CDLIBasket(Folder,CatalogAware): user = username ob=manage_addCDLIBasketVersion(self,user,comment="",basketContent=content) - + logging.info("add to basket (%s) done"%(self.getId())) return added @@ -2152,7 +2164,7 @@ class CDLIRoot(Folder): obj=self.ZopeFind(root,obj_ids=[folder]) if ext: - ext.result+="

adding: %s

"%f + ext.result="

adding: %s

"%f+ext.result if not obj: manage_addCDLIFileFolder(root,folder,folder) fobj=getattr(root,folder)