Diff for /cdli/cdli_files.py between versions 1.102 and 1.103

version 1.102, 2008/10/29 12:10:05 version 1.103, 2008/11/05 19:53:32
Line 19  from ZPublisher.HTTPRequest import HTTPR Line 19  from ZPublisher.HTTPRequest import HTTPR
 from ZPublisher.HTTPResponse import HTTPResponse  from ZPublisher.HTTPResponse import HTTPResponse
 from ZPublisher.BaseRequest import RequestContainer  from ZPublisher.BaseRequest import RequestContainer
 import threading  import threading
 from BTrees.OOBTree import OOBTree, OOTreeSet  
 import logging  import logging
 import transaction  import transaction
 import copy  import copy
Line 31  from sets import Set Line 30  from sets import Set
 import md5  import md5
 from DownloadBasket import DownloadBasketFinallyThread  from DownloadBasket import DownloadBasketFinallyThread
 from types import *  from types import *
   import pickle
                                                                                 
 def makelist(mySet):  def makelist(mySet):
         x = list(mySet)          x = list(mySet)
Line 641  class CDLIBasketContainer(OrderedFolder) Line 641  class CDLIBasketContainer(OrderedFolder)
     security=ClassSecurityInfo()      security=ClassSecurityInfo()
     meta_type="CDLIBasketContainer"      meta_type="CDLIBasketContainer"
           
       def getResultHash(self):
           """get the result hash for debug purposes"""
           return self.resultHash.keys()
       
     def getPNumbersOfBasket(self,basketName):      def getPNumbersOfBasket(self,basketName):
         """get all pnumbers of a basket as a list, returns an empty list if basket not found          """get all pnumbers of a basket as a list, returns an empty list if basket not found
         @param basketName: name of the basket          @param basketName: name of the basket
Line 1446  class CDLIBasketVersion(Implicit,Persist Line 1450  class CDLIBasketVersion(Implicit,Persist
             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!"""
   
   
         if (check=="yes") and self.containsNonActualFiles():          #if (check=="yes") and self.containsNonActualFiles():
             pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','downloadObjectAsOneFile_check.zpt')).__of__(self)          #    pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','downloadObjectAsOneFile_check.zpt')).__of__(self)
           #    
           #    return pt(lock=lock)
           
           # neue Version aus Performancegruenden, es wird nicht mehr getestet, ob es nicht aktuelle Objekte gibt
           # sondern lediglich gefragt.
           if (check=="yes"):
               pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','downloadObjectAsOneFile_ask.zpt')).__of__(self)
                           
             return pt(lock=lock)              return pt(lock=lock)
                           
Line 1578  class CDLIBasketVersion(Implicit,Persist Line 1589  class CDLIBasketVersion(Implicit,Persist
                                        self._v_downloadBasket[threadName]=thread                                         self._v_downloadBasket[threadName]=thread
                                                                                 
               #files = self._v_downloadBasket[threadName].result                #files = self._v_downloadBasket[threadName].result
               files=self.basketContainer.resultHash[threadName]                # lade die files und die locked files, bei grossen Baskets muss u.U. gewartet werden
               lockedFiles=self.basketContainer.resultLockedHash[threadName]                # bis das Commit aus dem Thread alles geschrieben hat, in dem Falle existiert resultHash[threadName]
                 # noch nicht.
                 o1 = file("/tmp/"+threadName,'r')
                 files=pickle.load(o1)
                 os.remove("/tmp/"+threadName)
                 o2 = file("/tmp/"+threadName+'_lockedFiles','r')
                 
                 lockedFiles=pickle.load(o2)
                 os.remove("/tmp/"+threadName+'_lockedFiles')
   #              try:
   #                  files=self.basketContainer.resultHash[threadName]
   #              except:
   #                  i=0
   #                  while (not self.basketContainer.resultHash.has_key(threadName)) and (i<100):
   #                      logging.debug(" downloadFinally: I am waiting for thread %s to write the resultHashfile: %s"%(threadName,i))
   #                      time.sleep(5)
   #                      i+=1
   #                  files=self.basketContainer.resultHash[threadName]  
   #              
   #              try:
   #                  lockedFiles=self.basketContainer.resultLockedHash[threadName]
   #              except:
   #                  i=0
   #                  while (not self.basketContainer.resultLockedHash.has_key(threadName)) and (i<100):
   #                      logging.debug(" downloadFinally: I am waiting for thread %s to write the LockedHashfile: %s"%(threadName,i))
   #                      time.sleep(5)
   #                      i+=1
   #                  lockedFiles=self.basketContainer.resultLockedHash[threadName]
             
              # fh=file("/var/tmp/test")               # fh=file("/var/tmp/test")
               #ret =fh.read()                #ret =fh.read()

Removed from v.1.102  
changed lines
  Added in v.1.103


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