Diff for /cdli/cdli_files.py between versions 1.57 and 1.58

version 1.57, 2007/01/09 16:06:09 version 1.58, 2007/01/24 18:05:24
Line 23  from ZPublisher.BaseRequest import Reque Line 23  from ZPublisher.BaseRequest import Reque
 import threading  import threading
 from BTrees.OOBTree import OOBTree  from BTrees.OOBTree import OOBTree
 import logging  import logging
   import transaction
   
 def unique(s):  def unique(s):
     """Return a list of the elements in s, but without duplicates.      """Return a list of the elements in s, but without duplicates.
Line 167  class uploadATFfinallyThread(Thread): Line 168  class uploadATFfinallyThread(Thread):
         #add the files          #add the files
         self.uploadATFfinallyThread(ctx,self.procedure,comment=self.comment,basketname=self.basketname,unlock=self.unlock,SESSION=self.SESSION,username=self.username)          self.uploadATFfinallyThread(ctx,self.procedure,comment=self.comment,basketname=self.basketname,unlock=self.unlock,SESSION=self.SESSION,username=self.username)
         #commit the transactions          #commit the transactions
         get_transaction().commit()          transaction.get().commit()
         conn.close()          conn.close()
         #set flag for end of this method          #set flag for end of this method
         self.end=True          self.end=True
Line 312  class uploadATFThread(Thread): Line 313  class uploadATFThread(Thread):
             
         #ctx.cdliRoot.cdli_main.tmpStore2[self.getName()[0:]]=self.returnValue          #ctx.cdliRoot.cdli_main.tmpStore2[self.getName()[0:]]=self.returnValue
   
         get_transaction().commit()  
           
           transaction.get().commit()
         while self.continueVar:          while self.continueVar:
             pass              pass
                 
Line 630  class BasketObject_old(Folder): Line 631  class BasketObject_old(Folder):
                   
         self.temp_folder.downloadCounter+=1           self.temp_folder.downloadCounter+=1 
         self._p_changed=1          self._p_changed=1
         get_transaction().commit()        
   
           transaction.get().commit()
                   
         for object in self.contents:          for object in self.contents:
                           
Line 649  class BasketObject_old(Folder): Line 650  class BasketObject_old(Folder):
         self.REQUEST.RESPONSE.write(ret)              self.REQUEST.RESPONSE.write(ret)    
         self.temp_folder.downloadCounter-=1           self.temp_folder.downloadCounter-=1 
         self._p_changed=1          self._p_changed=1
         get_transaction().commit()                transaction.get().commit()
                
                   
                   
 def manage_addBasket_oldObjectForm(self):  def manage_addBasket_oldObjectForm(self):
Line 1199  class CDLIBasketVersion(Implicit,Persist Line 1201  class CDLIBasketVersion(Implicit,Persist
             if str(self.REQUEST['AUTHENTICATED_USER'])=='Anonymous User':              if str(self.REQUEST['AUTHENTICATED_USER'])=='Anonymous User':
                 self.temp_folder.downloadCounterBaskets-=1                   self.temp_folder.downloadCounterBaskets-=1 
                 self._p_changed=1                  self._p_changed=1
                 get_transaction().commit()                        transaction.get().commit()      
                 self.temp_folder.downloadCounterBaskets-=1                   self.temp_folder.downloadCounterBaskets-=1 
                 self._p_changed=1                  self._p_changed=1
                 get_transaction().commit()                        transaction.get().commit()      
                 return "please login first"                  return "please login first"
   
             #check if a locked object exist in the basket.              #check if a locked object exist in the basket.
Line 1222  class CDLIBasketVersion(Implicit,Persist Line 1224  class CDLIBasketVersion(Implicit,Persist
                                   
                 self.temp_folder.downloadCounterBaskets-=1                   self.temp_folder.downloadCounterBaskets-=1 
                 self._p_changed=1                  self._p_changed=1
                 get_transaction().commit()                        transaction.get().commit()      
   
                 return pt()                  return pt()
                     
Line 1252  class CDLIBasketVersion(Implicit,Persist Line 1254  class CDLIBasketVersion(Implicit,Persist
   
         self.temp_folder.downloadCounterBaskets-=1           self.temp_folder.downloadCounterBaskets-=1 
         self._p_changed=1          self._p_changed=1
         get_transaction().commit()                transaction.get().commit()      
                   
         self.REQUEST.RESPONSE.setHeader("Content-Disposition","""attachement; filename="%s.atf" """%basket_name)          self.REQUEST.RESPONSE.setHeader("Content-Disposition","""attachement; filename="%s.atf" """%basket_name)
         self.REQUEST.RESPONSE.setHeader("Content-Type","application/octet-stream")          self.REQUEST.RESPONSE.setHeader("Content-Type","application/octet-stream")
Line 1831  class CDLIFileFolder(extVersionedFileFol Line 1833  class CDLIFileFolder(extVersionedFileFol
   
         self.temp_folder.downloadCounter+=1          self.temp_folder.downloadCounter+=1
         self._p_changed=1          self._p_changed=1
         get_transaction().commit()          transaction.get().commit()
                 
         list=[(x.getId,x) for x in catalog()]          list=[(x.getId,x) for x in catalog()]
         list.sort(sortF)          list.sort(sortF)
Line 1851  class CDLIFileFolder(extVersionedFileFol Line 1853  class CDLIFileFolder(extVersionedFileFol
                     RESPONSE.write(obj.getLastVersion().getData()[0:])                      RESPONSE.write(obj.getLastVersion().getData()[0:])
                 self.temp_folder.downloadCounter-=1                   self.temp_folder.downloadCounter-=1 
                 self._p_changed=1                  self._p_changed=1
         get_transaction().commit()          transaction.get().commit()
         #os.close(tf)          #os.close(tf)
         #RESPONSE.redirect(self.absolute_url()+"/downloadFile?fn="%tfilename)          #RESPONSE.redirect(self.absolute_url()+"/downloadFile?fn="%tfilename)
         return True          return True
Line 2024  class CDLIRoot(Folder): Line 2026  class CDLIRoot(Folder):
                   
         self.lineIndex=li          self.lineIndex=li
             
         get_transaction().commit()          transaction.get().commit()
                   
   
     def showFile(self,fileId):      def showFile(self,fileId):
Line 2106  class CDLIRoot(Folder): Line 2108  class CDLIRoot(Folder):
         """unquote url"""          """unquote url"""
         return urllib.unquote(str)          return urllib.unquote(str)
           
       def URLquote_plus(self,str):
           """quote url"""
           return urllib.quote_plus(str)
       
       def URLunquote_plus(self,str):
           """unquote url"""
           return urllib.unquote_plus(str)
       
           
     def forceunlock(self):      def forceunlock(self):
         "break all locks"          "break all locks"
Line 2338  class CDLIRoot(Folder): Line 2348  class CDLIRoot(Folder):
             if not obj:              if not obj:
                 manage_addCDLIFileFolder(root,folder,folder)                  manage_addCDLIFileFolder(root,folder,folder)
                 fobj=getattr(root,folder)                  fobj=getattr(root,folder)
                 #get_transaction().commit()                                             #transaction.get().commit()                           
             else:              else:
                 fobj=obj[0][1]                  fobj=obj[0][1]
                           
Line 2366  class CDLIRoot(Folder): Line 2376  class CDLIRoot(Folder):
   
         if count > 1000:          if count > 1000:
         print "committing"          print "committing"
         get_transaction().commit()          transaction.get().commit()
         count=0          count=0
     get_transaction().commit()          transaction.get().commit()
         return "ok"          return "ok"
                     
   

Removed from v.1.57  
changed lines
  Added in v.1.58


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