Diff for /versionedFile/versionedFile.py between versions 1.46 and 1.50

version 1.46, 2005/10/18 15:45:02 version 1.50, 2005/11/02 12:38:52
Line 8  from AccessControl import getSecurityMan Line 8  from AccessControl import getSecurityMan
 from Products.PageTemplates.PageTemplate import PageTemplate  from Products.PageTemplates.PageTemplate import PageTemplate
 from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate  from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate
 from AccessControl import ClassSecurityInfo  from AccessControl import ClassSecurityInfo
   <<<<<<< versionedFile.py
   from Products.ImageArchive.ImageArchive import manage_AddImageZogiLib
   from Products.ZCatalog.CatalogPathAwareness import CatalogAware
   =======
 try:  try:
  from Products.ImageArchive.ImageArchive import manage_AddImageZogiLib   from Products.ImageArchive.ImageArchive import manage_AddImageZogiLib
 except:  except:
  print "no images"   print "no images"
   >>>>>>> 1.49
   
 from threading import Thread  from threading import Thread
 import shutil  import shutil
Line 116  class versionedFileFolder(Folder,ECHO_ba Line 121  class versionedFileFolder(Folder,ECHO_ba
   
     security= ClassSecurityInfo()      security= ClassSecurityInfo()
     security.declareProtected('AUTHENTICATED_USER','addFileForm')      security.declareProtected('AUTHENTICATED_USER','addFileForm')
       filesMetaType=['versionedFile']
     if ECHO_basis:      if ECHO_basis:
         optTMP= Folder.manage_options+ECHO_basis.manage_options          optTMP= Folder.manage_options+ECHO_basis.manage_options
     else:      else:
Line 332  class versionedFileFolder(Folder,ECHO_ba Line 337  class versionedFileFolder(Folder,ECHO_ba
                           
             return cmp(x[1].getLastVersion().lastEditor().lower(),y[1].getLastVersion().lastEditor().lower())              return cmp(x[1].getLastVersion().lastEditor().lower(),y[1].getLastVersion().lastEditor().lower())
                   
     versionedFiles=self.ZopeFind(self,obj_metatypes=['versionedFile'])          versionedFiles=self.ZopeFind(self,obj_metatypes=self.filesMetaType)
           
   
         if sortField=='title':          if sortField=='title':
             versionedFiles.sort(sortName)              versionedFiles.sort(sortName)
Line 457  def manage_addVersionedFileFolder(self, Line 463  def manage_addVersionedFileFolder(self,
   
 class versionedFileObject(File):  class versionedFileObject(File):
     """File Object im Folder"""      """File Object im Folder"""
           security= ClassSecurityInfo()
     meta_type = "versionedFileObject"      meta_type = "versionedFileObject"
           
     manage_editForm  =DTMLFile('dtml/fileEdit',globals(),      manage_editForm  =DTMLFile('dtml/fileEdit',globals(),
                                Kind='File',kind='file')                                 Kind='File',kind='file')
     manage_editForm._setName('manage_editForm')      manage_editForm._setName('manage_editForm')
   <<<<<<< versionedFile.py
   
       security.declarePublic('getVComment')
   =======
     security= ClassSecurityInfo()      security= ClassSecurityInfo()
   
   >>>>>>> 1.49
     def getVComment(self):      def getVComment(self):
         """get the comment of this file"""          """get the comment of this file"""
         if not hasattr(self,'vComment') or (not self.vComment) or (self.vComment.lstrip()==""):          if not hasattr(self,'vComment') or (not self.vComment) or (self.vComment.lstrip()==""):
Line 499  class versionedFileObject(File): Line 510  class versionedFileObject(File):
             return REQUEST.RESPONSE.redirect(self.REQUEST.SESSION['refer'])              return REQUEST.RESPONSE.redirect(self.REQUEST.SESSION['refer'])
         return REQUEST.RESPONSE.redirect(self.aq_parent.absolute_url()+"/history")          return REQUEST.RESPONSE.redirect(self.aq_parent.absolute_url()+"/history")
           
   <<<<<<< versionedFile.py
       security.declarePublic('getVersionComment')
       def getVersionComment(self):
           """getversioncomment"""
           return self.versionComment
       
     security.declarePublic('getTime')                                                    security.declarePublic('getTime')                                              
   =======
       security.declarePublic('getTime')                                              
   >>>>>>> 1.49
     def getTime(self):      def getTime(self):
         """getTime"""          """getTime"""
         #return self.bobobase_modification_time().ISO()          #return self.bobobase_modification_time().ISO()
Line 515  class versionedFileObject(File): Line 535  class versionedFileObject(File):
   
           
   
     def download(self):      def download(self,REQUEST=None,RESPONSE=None):
         """download and lock"""          """download and lock"""
                   
         self.REQUEST.RESPONSE.setHeader("Content-Disposition","""attachement; filename=%s"""%self.getId())          self.REQUEST.RESPONSE.setHeader("Content-Disposition","""attachement; filename=%s"""%self.getId())
     self.REQUEST.RESPONSE.setHeader("Content-Type","application/octet-stream")      self.REQUEST.RESPONSE.setHeader("Content-Type","application/octet-stream")
       #try:
       #   txt=self.index_html()
       #except:
       #   txt=self.index_html(REQUEST,RESPONSE)
       #
       #self.REQUEST.RESPONSE.setHeader("Content-Length","str(len(txt)+1000)")
               
         self.content_type="application/octet-stream"          self.content_type="application/octet-stream"
         self.REQUEST.RESPONSE.redirect(self.absolute_url())          self.REQUEST.RESPONSE.redirect(self.absolute_url())
     #self.REQUEST.RESPONSE.write(self.index_html())  
         #txt=urllib.urlopen(self.absolute_url()).read()          #txt=urllib.urlopen(self.absolute_url()).read()
     #self.REQUEST.RESPONSE.write(txt)      #self.REQUEST.RESPONSE.write(txt)
         #self.REQUEST.RESPONSE.write("bl")      
         self.REQUEST.close()  
           #self.REQUEST.close()
           
     def downloadLocked(self):      def downloadLocked(self):
         """download and lock"""          """download and lock"""
Line 546  class versionedFileObject(File): Line 572  class versionedFileObject(File):
         """set version"""          """set version"""
         self.versionNumber=versionNumber          self.versionNumber=versionNumber
   
   <<<<<<< versionedFile.py
   
     security.declarePublic('getVersionNumber')                                                    security.declarePublic('getVersionNumber')                                              
   =======
       security.declarePublic('getVersionNumber')                                              
   >>>>>>> 1.49
     def getVersionNumber(self):      def getVersionNumber(self):
         """get version"""          """get version"""
         return self.versionNumber          return self.versionNumber
Line 557  class versionedFileObject(File): Line 588  class versionedFileObject(File):
         return self.versionComment          return self.versionComment
   
         
   <<<<<<< versionedFile.py
       security.declarePublic('lastEditor')         
   =======
     security.declarePublic('lastEditor')                                                      security.declarePublic('lastEditor')                                                
   >>>>>>> 1.49
     def lastEditor(self):      def lastEditor(self):
         """last Editor"""          """last Editor"""
         if hasattr(self,'author'):          if hasattr(self,'author'):
Line 613  def manage_addVersionedFileObject(self,i Line 648  def manage_addVersionedFileObject(self,i
   
   
   
 class versionedFile(Folder):  class versionedFile(CatalogAware,Folder):
     """Versioniertes File"""      """Versioniertes File"""
   
       default_catalog='fileCatalog'
       
       def PrincipiaSearchSource(self):
              """Return cataloguable key for ourselves."""
              return str(self)
          
     def __init__(self, id, title, lockedBy,author):      def __init__(self, id, title, lockedBy,author):
         """init"""          """init"""
         self.id=id          self.id=id
Line 707  class versionedFile(Folder): Line 748  class versionedFile(Folder):
         tmp=0          tmp=0
         lastVersion=None          lastVersion=None
                   
           
         for version in self.ZopeFind(self):          for version in self.ZopeFind(self):
                           
             if hasattr(version[1],'versionNumber'):              if hasattr(version[1],'versionNumber'):
Line 714  class versionedFile(Folder): Line 756  class versionedFile(Folder):
                 if int(version[1].versionNumber) > tmp:                  if int(version[1].versionNumber) > tmp:
                     tmp=int(version[1].versionNumber,)                      tmp=int(version[1].versionNumber,)
                     lastVersion=version[1]                      lastVersion=version[1]
               if lastVersion==None:
                   lastVersion=version[1]
                   lastVersion.versionNumber=1
         return lastVersion          return lastVersion
           
     def index_html(self):      def index_html(self):
Line 832  class versionedFile(Folder): Line 877  class versionedFile(Folder):
         self.REQUEST.RESPONSE.setHeader("Content-Disposition","""attachement; filename=%s"""%self.getLastVersion().getId())          self.REQUEST.RESPONSE.setHeader("Content-Disposition","""attachement; filename=%s"""%self.getLastVersion().getId())
     self.REQUEST.RESPONSE.setHeader("Content-Type","application/octet-stream")      self.REQUEST.RESPONSE.setHeader("Content-Type","application/octet-stream")
               
       #try:   
       #   txt=self.getLastVersion.index_html()
       #except:
       #   txt=self.getLastVersion.index_html(REQUEST,RESPONSE)
   
       #self.REQUEST.RESPONSE.setHeader("Content-Length","str(len(txt)+1000)")
           
         self.content_type="application/octet-stream"          self.content_type="application/octet-stream"
         #self.REQUEST.RESPONSE.write("bl")          #self.REQUEST.RESPONSE.write("bl")
         self.REQUEST.RESPONSE.write(self.getLastVersion().index_html())          #self.REQUEST.RESPONSE.write(txt)
         self.REQUEST.close()          #self.REQUEST.close()
   
         #self.getLastVersion().content_type="application/octet-stream"          #self.getLastVersion().content_type="application/octet-stream"
         #self.REQUEST.RESPONSE.redirect(self.REQUEST['URL1']+'/'+self.getId()+'/'+self.getLastVersion().getId())          self.REQUEST.RESPONSE.redirect(self.REQUEST['URL1']+'/'+self.getId()+'/'+self.getLastVersion().getId())
           
     def downloadLocked(self):      def downloadLocked(self):
         """download and lock"""          """download and lock"""

Removed from v.1.46  
changed lines
  Added in v.1.50


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