Diff for /versionedFile/extVersionedFile.py between versions 1.26 and 1.31

version 1.26, 2008/08/19 14:43:25 version 1.31, 2009/06/05 07:32:17
Line 628  class extVersionedFileObject(ExtFile): Line 628  class extVersionedFileObject(ExtFile):
           
     def getData(self):      def getData(self):
         """returns object content (calls ExtFile.index_html)"""          """returns object content (calls ExtFile.index_html)"""
           #logging.debug("+++++++getData1:"+repr(self.get_filename()))
           filename = self.get_filename()
           #return ExtFile.index_html(self)
           try:
               return file(filename).read()
           except:
         return ExtFile.index_html(self)          return ExtFile.index_html(self)
           
       
       def getFileName(self):
           """return filename"""
           return self.get_filename()
       
       def addToFile(self,filehandle):
           filehandle.write(self.getData())
           
       def addToFile2(self,filename):   
            str="cat %s > %s"%(self.get_filename(),filename)
            os.popen(str)
            
     security.declarePublic('getVComment')      security.declarePublic('getVComment')
     def getVComment(self):      def getVComment(self):
         """get the comment of this file"""          """get the comment of this file"""
Line 933  class extVersionedFile(CatalogAware,Fold Line 951  class extVersionedFile(CatalogAware,Fold
         lv=None          lv=None
                   
         for v in self.objectValues(self.content_meta_type):          for v in self.objectValues(self.content_meta_type):
             logging.debug("getlastversion: check %s"%v.getId())              #logging.debug("getlastversion: check %s"%v.getId())
             if v.getVersionNumber() > tmp:              if v.getVersionNumber() > tmp:
                     tmp=v.getVersionNumber()                      tmp=v.getVersionNumber()
                     lv=v                      lv=v
                   
         logging.debug("getlastversion: got %s"%lv.getId())          #ogging.debug("getlastversion: got %s"%lv.getId())
         return lv          return lv
   
     def getContentObject(self):      def getContentObject(self):
Line 956  class extVersionedFile(CatalogAware,Fold Line 974  class extVersionedFile(CatalogAware,Fold
     security.declarePublic('getData')      security.declarePublic('getData')
     def getData(self):      def getData(self):
         """Returns the content of the last version"""          """Returns the content of the last version"""
           logging.debug("+++++++getData2")
         ob = self.getContentObject()          ob = self.getContentObject()
         if ob is not None:          if ob is not None:
             return ob.getData()              return ob.getData()
Line 999  class extVersionedFile(CatalogAware,Fold Line 1018  class extVersionedFile(CatalogAware,Fold
         #return "File: %s Version:%i modified:%s size:%s modified by:%s"%(self.title,lastVersion.versionNumber,lastVersion.getTime(),lastVersion.getSize(),lastVersion.lastEditor())          #return "File: %s Version:%i modified:%s size:%s modified by:%s"%(self.title,lastVersion.versionNumber,lastVersion.getTime(),lastVersion.getSize(),lastVersion.lastEditor())
         return self.history()          return self.history()
   
       def getVersionNr(self,nr):
           """get version with number nr"""
           tmp=0
           lastVersion=None
           
           
           for version in self.ZopeFind(self):
               
               if hasattr(version[1],'versionNumber'):
                   
                   if int(version[1].versionNumber) ==nr :
                       return version[1]
           
           return None
     security.declarePublic('getVersion')                                                    security.declarePublic('getVersion')                                              
     def getVersion(self):      def getVersion(self):
         # TODO: this is ugly and it returns the next version number           # TODO: this is ugly and it returns the next version number 
Line 1044  class extVersionedFile(CatalogAware,Fold Line 1076  class extVersionedFile(CatalogAware,Fold
         return vl          return vl
   
     security.declareProtected('AUTHENTICATED_USER','forceunlock')         security.declareProtected('AUTHENTICATED_USER','forceunlock')   
     def forceunlock(self,RESPONSE=None):      def forceunlock(self,RESPONSE=None,user=None):
         """unlock"""          """unlock"""
         #safe who had the lock          #safe who had the lock
           logging.debug("extVersionFile: (forceunlock)"+str(user))
         if self.lockedBy:          if self.lockedBy:
               if user is not None:
                   if str(self.lockedBy)==user:
             self.brokenLock=str(self.lockedBy)              self.brokenLock=str(self.lockedBy)
                       self.lockedBy=''
         else:          else:
             self.brokenLock=""              self.brokenLock=""
               else:
                   self.brokenLock=str(self.lockedBy)
         self.lockedBy=''          self.lockedBy=''
           else:
               self.brokenLock=""
           
         return self.brokenLock          return self.brokenLock
   
     security.declareProtected('AUTHENTICATED_USER','unlock')         security.declareProtected('AUTHENTICATED_USER','unlock')   

Removed from v.1.26  
changed lines
  Added in v.1.31


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