Diff for /cdli/cdli_files.py between versions 1.23 and 1.24

version 1.23, 2006/06/14 18:50:09 version 1.24, 2006/06/15 20:08:44
Line 214  class uploadATFThread(Thread): Line 214  class uploadATFThread(Thread):
         app  = root['Application']          app  = root['Application']
         ctx = self.getContext(app,serverport=self.serverport)          ctx = self.getContext(app,serverport=self.serverport)
         self.uploadATFThread(ctx,self.upload,self.basketId)          self.uploadATFThread(ctx,self.upload,self.basketId)
         ctx.cdliRoot.cdli_main.tmpStore=self.returnValue       
           ctx.cdliRoot.cdli_main.tmpStore2[self.getName()[0:]]=self.returnValue
   
         get_transaction().commit()          get_transaction().commit()
                   
         while self.continueVar:          while self.continueVar:
Line 1263  class CDLIFileFolder(versionedFileFolder Line 1265  class CDLIFileFolder(versionedFileFolder
     filesMetaType=['CDLI file']      filesMetaType=['CDLI file']
     folderMetaType=['CDLI Folder']      folderMetaType=['CDLI Folder']
     default_catalog='CDLICatalog'      default_catalog='CDLICatalog'
     tmpStore=None      tmpStore2={}
     def setTemp(self,name,value):      def setTemp(self,name,value):
         """set tmp"""          """set tmp"""
   
Line 1469  class CDLIRoot(Folder): Line 1471  class CDLIRoot(Folder):
           
     meta_type="CDLIRoot"      meta_type="CDLIRoot"
           
     def refreshTxt(self,txt=""):      def refreshTxt(self,txt="",threadName=None):
         """txt fuer refresh"""          """txt fuer refresh"""
       
         return """ 2;url=%s?repeat=%s """%(self.absolute_url()+txt,self.threadName)          return """ 2;url=%s?repeat=%s """%(self.absolute_url()+txt,threadName)
   
           
     def getResult(self):      def getResult(self,threadName=None):
        """result of thread"""         """result of thread"""
        try:         try:
         return self._v_uploadATF.getResult()          return self._v_uploadATF[threadName].getResult()
        except:         except:
         return "One moment, please"          return "One moment, please"
           
           
       def checkThreads(self):
           """check threads"""
           return threading.enumerate()
       
     def uploadATF(self,repeat=None,upload=None,basketId=0,RESPONSE=None):      def uploadATF(self,repeat=None,upload=None,basketId=0,RESPONSE=None):
         """standard ausgabe"""          """standard ausgabe"""
         #self._v_uploadATF.returnValue=None          #self._v_uploadATF.returnValue=None
Line 1489  class CDLIRoot(Folder): Line 1496  class CDLIRoot(Folder):
         threadName=repeat          threadName=repeat
         if not threadName or threadName=="":          if not threadName or threadName=="":
             tmpVar=False              tmpVar=False
          
             thread=uploadATFThread()              thread=uploadATFThread()
             self._v_uploadATF=thread              threadName=thread.getName()[0:]                                
               if not hasattr(self,'_v_uploadATF'):
                      self._v_uploadATF={}
                                          
               self._v_uploadATF[threadName]=thread
             #self._xmltrans.start()              #self._xmltrans.start()
             #thread=Thread(target=self._v_uploadATF)              #thread=Thread(target=self._v_uploadATF)
                           
             self._v_uploadATF.set(upload,basketId,self.REQUEST['AUTHENTICATED_USER'],serverport=self.REQUEST['SERVER_PORT'])              self._v_uploadATF[threadName].set(upload,basketId,self.REQUEST['AUTHENTICATED_USER'],serverport=self.REQUEST['SERVER_PORT'])
             #thread.start()              #thread.start()
             self._v_uploadATF.start()              self._v_uploadATF[threadName].start()
   
                           
             self.threadName=self._v_uploadATF.getName()[0:]              self.threadName=self._v_uploadATF[threadName].getName()[0:]
             wait_template=self.aq_parent.ZopeFind(self.aq_parent,obj_ids=['wait_template'])              wait_template=self.aq_parent.ZopeFind(self.aq_parent,obj_ids=['wait_template'])
   
             if wait_template:              if wait_template:
                 return wait_template[0][1]()                  return wait_template[0][1]()
             pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','uploadATFWait.zpt')).__of__(self)              pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','uploadATFWait.zpt')).__of__(self)
             return pt(txt='/uploadATF')              return pt(txt='/uploadATF',threadName=threadName)
             #_v_xmltrans.run()              #_v_xmltrans.run()
                           
         else:          else:
             #recover thread, if lost              #recover thread, if lost
             if not hasattr(self,'_v_uploadATF'):              if not hasattr(self,'_v_uploadATF'):
                  self._v_uploadATF={}
               if not self._v_uploadATF.get(threadName,None):
                  for thread in threading.enumerate():                   for thread in threading.enumerate():
                          if threadName == thread.getName():                           if threadName == thread.getName():
                                        self._v_uploadATF=thread                                         self._v_uploadATF[threadName]=thread
   
             if not self._v_uploadATF.returnValue:              if not self._v_uploadATF[threadName].returnValue:
                   
   
                 wait_template=self.aq_parent.ZopeFind(self.aq_parent,obj_ids=['wait_template'])                  wait_template=self.aq_parent.ZopeFind(self.aq_parent,obj_ids=['wait_template'])
Line 1524  class CDLIRoot(Folder): Line 1538  class CDLIRoot(Folder):
                                   
                 pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','uploadATFWait.zpt')).__of__(self)                  pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','uploadATFWait.zpt')).__of__(self)
   
                 return pt(txt='/uploadATF')                  return pt(txt='/uploadATF',threadName=threadName)
                                   
             else:              else:
 #                tmp={}  #                tmp={}
 #                for key in self._v_uploadATF.returnValue.keys():  #                for key in self._v_uploadATF[threadName].returnValue.keys():
 #                        t=self._v_uploadATF.returnValue[key]  #                        t=self._v_uploadATF[threadName].returnValue[key]
 #                        if type(t) is ListType:  #                        if type(t) is ListType:
 #                                       tmp[key]=self._v_uploadATF.returnValue[key][0:]  #                                       tmp[key]=self._v_uploadATF[threadName].returnValue[key][0:]
 #                        else:  #                        else:
 #                                       tmp[key]=self._v_uploadATF.returnValue[key]  #                                       tmp[key]=self._v_uploadATF[threadName].returnValue[key]
                 tmp=self.cdli_main.tmpStore  
   
                 self._v_uploadATF.continueVar=False                  tmp=self.cdli_main.tmpStore2[threadName]
                   del(self.cdli_main.tmpStore2[threadName])
                   self._v_uploadATF[threadName].continueVar=False
                 self.REQUEST.SESSION['changed']=[x[0].getId() for x in tmp['changed']]                  self.REQUEST.SESSION['changed']=[x[0].getId() for x in tmp['changed']]
                 self.REQUEST.SESSION['errors']=[x.getId() for x in tmp['errors']]                  self.REQUEST.SESSION['errors']=[x.getId() for x in tmp['errors']]
                 self.REQUEST.SESSION['newPs']=tmp['newPs']                  self.REQUEST.SESSION['newPs']=tmp['newPs']
Line 1553  class CDLIRoot(Folder): Line 1568  class CDLIRoot(Folder):
                 
         threadName=repeat          threadName=repeat
         if not threadName or threadName=="":          if not threadName or threadName=="":
               thread=uploadATFfinallyThread()
               threadName=thread.getName()[0:]
               self._v_uploadATF[threadName]=thread
                           
                         
             self._v_uploadATF=uploadATFfinallyThread()              self._v_uploadATF[threadName].set(procedure,comment=comment,basketname=basketname,unlock=unlock,SESSION=self.REQUEST.SESSION,username=self.REQUEST['AUTHENTICATED_USER'],serverport=self.REQUEST['SERVER_PORT'])
   
                   
             self._v_uploadATF.set(procedure,comment=comment,basketname=basketname,unlock=unlock,SESSION=self.REQUEST.SESSION,username=self.REQUEST['AUTHENTICATED_USER'],serverport=self.REQUEST['SERVER_PORT'])              self._v_uploadATF[threadName].start()
   
             self._v_uploadATF.start()  
   
                           
             self.threadName=self._v_uploadATF.getName()[0:]  
             wait_template=self.aq_parent.ZopeFind(self.aq_parent,obj_ids=['wait_template'])              wait_template=self.aq_parent.ZopeFind(self.aq_parent,obj_ids=['wait_template'])
   
             if wait_template:              if wait_template:
                 return wait_template[0][1]()                  return wait_template[0][1]()
             pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','uploadATFWait.zpt')).__of__(self)              pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','uploadATFWait.zpt')).__of__(self)
   
             return pt(txt='/uploadATFfinally')              return pt(txt='/uploadATFfinally',threadName=threadName)
             #_v_xmltrans.run()              #_v_xmltrans.run()
                   
         else:          else:
             #recover thread, if lost              #recover thread, if lost
             if not hasattr(self,'_v_uploadATF'):              if not hasattr(self,'_v_uploadATF'):
                  self._v_uploadATF={}
               if not self._v_uploadATF.get(threadName,None):
                  for thread in threading.enumerate():                   for thread in threading.enumerate():
                          if threadName == thread.getName():                           if threadName == thread.getName():
                                        self._v_uploadATF=thread                                         self._v_uploadATF[threadName]=thread
                                                                                 
             if hasattr(self,'_v_uploadATF') and (self._v_uploadATF is not None) and (not self._v_uploadATF.end) :              if self._v_uploadATF.get(threadName,None) and (self._v_uploadATF[threadName] is not None) and (not self._v_uploadATF[threadName].end) :
   
                 wait_template=self.aq_parent.ZopeFind(self.aq_parent,obj_ids=['wait_template'])                  wait_template=self.aq_parent.ZopeFind(self.aq_parent,obj_ids=['wait_template'])
                 if wait_template:                  if wait_template:
                         return wait_template[0][1]()                          return wait_template[0][1]()
                                   
                 pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','uploadATFWait.zpt')).__of__(self)                  pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','uploadATFWait.zpt')).__of__(self)
                 return pt(txt='/uploadATFfinally')                  return pt(txt='/uploadATFfinally',threadName=threadName)
             else:              else:
   
               if RESPONSE is not None:                if RESPONSE is not None:

Removed from v.1.23  
changed lines
  Added in v.1.24


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