Diff for /versionedFile/versionedFile.py between versions 1.60 and 1.68

version 1.60, 2006/05/22 10:54:31 version 1.68, 2006/10/04 07:35:27
Line 9  from Products.PageTemplates.ZopePageTemp Line 9  from Products.PageTemplates.ZopePageTemp
 from AccessControl import ClassSecurityInfo  from AccessControl import ClassSecurityInfo
 from difflib import Differ  from difflib import Differ
 from pprint import pprint  from pprint import pprint
   
 from Products.ZCatalog.CatalogPathAwareness import CatalogAware  from Products.ZCatalog.CatalogPathAwareness import CatalogAware
   
 try:  try:
Line 136  class versionedFileFolder(Folder,ECHO_ba Line 135  class versionedFileFolder(Folder,ECHO_ba
                 {'label':'Position of version number','action':'changeHistoryFileNamesForm'},                  {'label':'Position of version number','action':'changeHistoryFileNamesForm'},
                 )                  )
   
               
     def changeHistoryFileNamesForm(self):      def changeHistoryFileNamesForm(self):
         """change position of version num"""          """change position of version num"""
         pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','changeHistoryFileNamesForm.zpt')).__of__(self)          pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','changeHistoryFileNamesForm.zpt')).__of__(self)
Line 539  class versionedFileObject(File): Line 539  class versionedFileObject(File):
     manage_editForm._setName('manage_editForm')      manage_editForm._setName('manage_editForm')
   
   
       
    
     security.declarePublic('getTitle')      security.declarePublic('getTitle')
   
     def getTitle(self):      def getTitle(self):
Line 665  class versionedFileObject(File): Line 667  class versionedFileObject(File):
             except:#old version of versionded file sometimes stored the user object and not only the name the following corrects this              except:#old version of versionded file sometimes stored the user object and not only the name the following corrects this
                 ret=str(self.author).replace("-","\n")                  ret=str(self.author).replace("-","\n")
             ret=ret.replace("\r","\n")              ret=ret.replace("\r","\n")
             return ret              return ret.lstrip().rstrip()
   
         else:          else:
             jar=self._p_jar              jar=self._p_jar
Line 816  class versionedFile(CatalogAware,Folder) Line 818  class versionedFile(CatalogAware,Folder)
                 self.comment_date=time.strftime("%Y-%m-%d %H:%M:%S",time.localtime())                  self.comment_date=time.strftime("%Y-%m-%d %H:%M:%S",time.localtime())
   
         return REQUEST.RESPONSE.redirect(self.aq_parent.absolute_url())          return REQUEST.RESPONSE.redirect(self.aq_parent.absolute_url())
           
       security.declarePublic('getLastChangeDate')
       
       def getLastChangeDate(self):
           """get last change date"""
           lv=self.getLastVersion()
           time=lv.getTime()
           return time
       
       def getLastEditor(self):
           """get last change date"""
           lv=self.getLastVersion()
           le=lv.lastEditor()
           return le
       
       def getLockedBy(self):
           """get locked by"""
           return str(self.lockedBy)
           
     security.declarePublic('getLastVersion')      security.declarePublic('getLastVersion')
     def getLastVersion(self):      def getLastVersion(self):
         """Last Version"""          """Last Version"""
Line 839  class versionedFile(CatalogAware,Folder) Line 860  class versionedFile(CatalogAware,Folder)
     def diff(self,data):      def diff(self,data):
         """differenz between lastversion and data"""          """differenz between lastversion and data"""
         d=Differ()          d=Differ()
         tmp=self.getLastVersion().data          data=data.rstrip()
       try:
           tmp=self.getLastVersion().data.rstrip()
       except:
           tmp=str(self.getLastVersion().data).rstrip()
         #print "XX",data,tmp          #print "XX",data,tmp
   
       try:
         l=list(d.compare(data.splitlines(1),tmp.splitlines(1)))          l=list(d.compare(data.splitlines(1),tmp.splitlines(1)))
           except:
           try:
               l=list(d.compare(repr(data).splitlines(1),tmp.splitlines(1)))
           except:
               return 9999,[]
                   
         plus=0          plus=0
         minus=0          minus=0
   
         for a in l:          for a in l:
             if a[0]=='+':              if a[0]=='+':
                 plus+=1                  plus+=1
Line 896  class versionedFile(CatalogAware,Folder) Line 929  class versionedFile(CatalogAware,Folder)
         return ret          return ret
   
     security.declareProtected('AUTHENTICATED_USER','forceunlock')         security.declareProtected('AUTHENTICATED_USER','forceunlock')   
     def forceunlock(self,RESPONSE):      def forceunlock(self,RESPONSE=None):
         """unlock"""          """unlock"""
           #safe who had the lock
           if self.lockedBy:
               self.brokenLock=str(self.lockedBy)
           else:
               self.brokenLock=""
         self.lockedBy=''          self.lockedBy=''
           return self.brokenLock
   
     security.declareProtected('AUTHENTICATED_USER','unlock')         security.declareProtected('AUTHENTICATED_USER','unlock')   
     def unlock(self,RESPONSE):      def unlock(self,RESPONSE):
Line 968  class versionedFile(CatalogAware,Folder) Line 1007  class versionedFile(CatalogAware,Folder)
         objs=self.ZopeFind(self,obj_ids=[id])[0][1].setVersionNumber(int(self.getVersion()))          objs=self.ZopeFind(self,obj_ids=[id])[0][1].setVersionNumber(int(self.getVersion()))
         self.REQUEST.SESSION['objID_parent']=self.getId()          self.REQUEST.SESSION['objID_parent']=self.getId()
   
           if getattr(self,'defaultFileCatalog',None):
               
               self.reindex_object()
               
         if RESPONSE:          if RESPONSE:
             obj=self.ZopeFind(self,obj_ids=[id])[0][1]              obj=self.ZopeFind(self,obj_ids=[id])[0][1]
             if obj.getSize()==0:              if obj.getSize()==0:

Removed from v.1.60  
changed lines
  Added in v.1.68


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