Diff for /cdli/cdli_files.py between versions 1.90 and 1.93

version 1.90, 2008/10/06 12:26:57 version 1.93, 2008/10/07 06:53:57
Line 401  class uploadATFfinallyThread(Thread): Line 401  class uploadATFfinallyThread(Thread):
                 basketId=ob.getId()                  basketId=ob.getId()
             basket=getattr(ctx2.basketContainer,str(basketId))              basket=getattr(ctx2.basketContainer,str(basketId))
             ids=os.listdir(SESSION['tmpdir'])              ids=os.listdir(SESSION['tmpdir'])
             logging.debug("should add:"+repr(ids))              #logging.debug("should add:"+repr(ids))
             basket.addObjects(ids,deleteOld=True,username=str(username))                  basket.addObjects(ids,deleteOld=True,username=str(username))    
                                 
         logging.debug("uploadatffinallythread uploadfinally done")          logging.debug("uploadatffinallythread uploadfinally done")
Line 640  class CDLIBasketContainer(OrderedFolder) Line 640  class CDLIBasketContainer(OrderedFolder)
                             ret+=str(object[0].getData())+"\n"                              ret+=str(object[0].getData())+"\n"
             elif current=="yes":              elif current=="yes":
                             #search current object                              #search current object
                             logging.debug("current: %s"%object[1].getId().split(".")[0])                              #logging.debug("current: %s"%object[1].getId().split(".")[0])
                             founds=self.CDLICatalog.search({'title':object[1].getId().split(".")[0]})                              founds=self.CDLICatalog.search({'title':object[1].getId().split(".")[0]})
                             if len(founds)>0:                                    if len(founds)>0:      
                                 ret+=str(founds[0].getObject().getLastVersion().getData())+"\n"                                  ret+=str(founds[0].getObject().getLastVersion().getData())+"\n"
Line 1032  class CDLIBasket(Folder,CatalogAware): Line 1032  class CDLIBasket(Folder,CatalogAware):
     def isActual(self,obj):      def isActual(self,obj):
         """teste ob im basket die aktuelle version ist"""          """teste ob im basket die aktuelle version ist"""
         try:          try:
             logging.debug("isActual:"+repr(obj))              #logging.debug("isActual:"+repr(obj))
             actualNo=obj[1].getLastVersion().getVersionNumber()              actualNo=obj[1].getLastVersion().getVersionNumber()
             storedNo=obj[0].getVersionNumber()              storedNo=obj[0].getVersionNumber()
                           
                         
             actualNo=self.getFileObjectLastVersion(obj.getId()).getVersionNumber()              #actualNo=self.getFileObjectLastVersion(obj.getId()).getVersionNumber()
                                   
             #if len(founds)>0 and founds[0].getObject().aq_parent.getId()==".trash":              #if len(founds)>0 and founds[0].getObject().aq_parent.getId()==".trash":
             #    return False, -1              #    return False, -1
Line 1047  class CDLIBasket(Folder,CatalogAware): Line 1047  class CDLIBasket(Folder,CatalogAware):
             else:              else:
                 return False, actualNo                  return False, actualNo
         except:          except:
               logging.error( """is actual: %s (%s %s)"""%(repr(obj),sys.exc_info()[0],sys.exc_info()[1]))
       
             return False, -1              return False, -1
                           
     def history(self):      def history(self):
Line 1222  class CDLIBasket(Folder,CatalogAware): Line 1224  class CDLIBasket(Folder,CatalogAware):
   
         hash = md5.new(repr(makelist(ids))).hexdigest() # erzeuge hash als identification          hash = md5.new(repr(makelist(ids))).hexdigest() # erzeuge hash als identification
         #logging.debug("JJJJJJJ:"+repr(self.makelist(ids)))          #logging.debug("JJJJJJJ:"+repr(self.makelist(ids)))
         logging.debug("JJJJJJJ:"+repr(hash))  
                                               
         if hasattr(self.cdliRoot,'v_tmpStore') and self.cdliRoot.v_tmpStore.has_key(hash):                         
           if hasattr(self.cdliRoot,'v_tmpStore') and self.cdliRoot.v_tmpStore.has_key("hash"): 
             logging.debug("from store!")              logging.debug("from store!")
             newContent=Set(map(swap,self.cdliRoot.v_tmpStore[hash]))              newContent=Set(map(swap,self.cdliRoot.v_tmpStore[hash]))
                     
Line 1253  class CDLIBasket(Folder,CatalogAware): Line 1255  class CDLIBasket(Folder,CatalogAware):
                   
         lv=self.getLastVersion()          lv=self.getLastVersion()
         for obj in lv.content.getContent():          for obj in lv.content.getContent():
             logging.info("XXXXXXXXXX %s"%repr(obj))              #logging.info("XXXXXXXXXX %s"%repr(obj))
             ret.append((obj[1].getId(),obj[0].versionNumber))              ret.append((obj[1].getId(),obj[0].versionNumber))
                           
         return ret          return ret
Line 1362  class CDLIBasketVersion(Implicit,Persist Line 1364  class CDLIBasketVersion(Implicit,Persist
     security.declareProtected('manage','downloadObjectsAsOneFile')      security.declareProtected('manage','downloadObjectsAsOneFile')
     def downloadObjectsAsOneFile(self,lock=None,procedure=None,REQUEST=None,check="yes",current="no"):      def downloadObjectsAsOneFile(self,lock=None,procedure=None,REQUEST=None,check="yes",current="no"):
         """download all selected files in one file"""          """download all selected files in one file"""
         logging.debug("doasof")          
         if self.temp_folder.downloadCounterBaskets > 10000:          if self.temp_folder.downloadCounterBaskets > 10000:
             return """I am sorry, currently the server has to many requests for downloads, please come back later!"""              return """I am sorry, currently the server has to many requests for downloads, please come back later!"""
   
Line 1379  class CDLIBasketVersion(Implicit,Persist Line 1381  class CDLIBasketVersion(Implicit,Persist
     def downloadObjectsAsOneFileFinally(self,lock=None,procedure=None,REQUEST=None,current="no",repeat=None):      def downloadObjectsAsOneFileFinally(self,lock=None,procedure=None,REQUEST=None,current="no",repeat=None):
         """print do the download"""          """print do the download"""
     
         logging.debug("HIHHHH")          
         ret=""          ret=""
         lockedObjects={}          lockedObjects={}
   
                         
         logging.debug("lock:"+repr(lock))      
         if lock:          if lock:
             logging.debug("------lock:"+repr(lock))              logging.debug("------lock:"+repr(lock))
             if str(self.REQUEST['AUTHENTICATED_USER'])=='Anonymous User':              if str(self.REQUEST['AUTHENTICATED_USER'])=='Anonymous User':
Line 1485  class CDLIBasketVersion(Implicit,Persist Line 1487  class CDLIBasketVersion(Implicit,Persist
               #files = self._v_downloadBasket[threadName].result                #files = self._v_downloadBasket[threadName].result
               files=self.basketContainer.resultHash[threadName]                files=self.basketContainer.resultHash[threadName]
               lockedFiles=self.basketContainer.resultLockedHash[threadName]                lockedFiles=self.basketContainer.resultLockedHash[threadName]
               logging.error(files)       
              # fh=file("/var/tmp/test")               # fh=file("/var/tmp/test")
               #ret =fh.read()                #ret =fh.read()
                     
Line 1508  class CDLIBasketVersion(Implicit,Persist Line 1510  class CDLIBasketVersion(Implicit,Persist
               self.REQUEST.RESPONSE.write(ret)                 self.REQUEST.RESPONSE.write(ret) 
                                     
               for fileName in files:                for fileName in files:
                   try:
                   self.REQUEST.RESPONSE.write(file(fileName).read())                    self.REQUEST.RESPONSE.write(file(fileName).read())
                   except:
                     logging.error("downloadasonefile: cannot read %s"%fileName)
                                       
                           
               self.REQUEST.RESPONSE.write("\n# locked files\n")                self.REQUEST.RESPONSE.write("\n# locked files\n")
               for fileName in lockedFiles:                for fileName in lockedFiles:
                   self.REQUEST.RESPONSE.write("#  %s\n"%fileName)                    self.REQUEST.RESPONSE.write("#  %s by %s\n"%fileName)
                               
               self.REQUEST.RESPONSE.write("# locked files end\n")                self.REQUEST.RESPONSE.write("# locked files end\n")
                               
Line 2116  class CDLIFileFolder(extVersionedFileFol Line 2121  class CDLIFileFolder(extVersionedFileFol
             ids = fileTree & self.v_file_ids              ids = fileTree & self.v_file_ids
             #self.REQUEST.SESSION['fileIds']=ids#store fieldIds in session for further usage              #self.REQUEST.SESSION['fileIds']=ids#store fieldIds in session for further usage
             l=makelist(fileTree)[0:]              l=makelist(fileTree)[0:]
             logging.debug("l-list:"+repr(l))              #logging.debug("l-list:"+repr(l))
             self.REQUEST.SESSION['fileIds']=l#store fieldIds in session for further usage              self.REQUEST.SESSION['fileIds']=l#store fieldIds in session for further usage
             self.REQUEST.SESSION['searchList']=l              self.REQUEST.SESSION['searchList']=l
             #self.REQUEST.SESSION['searchList']=['P000001.atf']              #self.REQUEST.SESSION['searchList']=['P000001.atf']
Line 2349  class CDLIRoot(Folder): Line 2354  class CDLIRoot(Folder):
     def getFileObjectLastVersion(self,fileId):      def getFileObjectLastVersion(self,fileId):
         """get an object"""          """get an object"""
         x=self.v_files_lastVersion.get(fileId)          x=self.v_files_lastVersion.get(fileId)
         #logging.debug(x)          l#ogging.debug("lastVersion: "+repr(x))
         return x          return x
           
     def showFileIds(self):      def showFileIds(self):

Removed from v.1.90  
changed lines
  Added in v.1.93


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>