Changeset 1903


Ignore:
Timestamp:
07/24/07 14:53:07 (12 years ago)
Author:
laszlo
Message:

Remove modifications from Resources.py.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Resources.py

    r1901 r1903  
    567567            self.storeInHistory(changedFields) 
    568568 
    569     def isID(self, s): 
    570         """ Stupid heuristic to decide s is an id or not. """ 
    571         if len(s) != 32: 
    572             return False 
    573         for i in range(len(s)): 
    574             if s[i] not in ['0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f']: 
    575                 return False 
    576         return True                 
    577  
    578     def correctReferences(self, oldBodyText, newBodyText): 
    579         """ Delete unused references after restore. """ 
    580         oldIDs = [x for x in oldBodyText if self.isID(x)] 
    581         newIDs = [x for x in newBodyText if self.isID(x)] 
    582         real_newIDs = [x for x in newIDs if x not in oldIDs] 
    583         real_oldIDs = [x for x in oldIDs if x not in newIDs] 
    584         tool = getToolByName(self, 'reference_catalog') 
    585         for x in real_oldIDs: 
    586              tool.deleteReference(self, x, 'uses')     
    587  
    588569    security.declareProtected(MODIFY_CONTENT, 'restoreAVersion') 
    589570    def restoreAVersion(self, timestamp): 
     
    594575                changedFields = [] 
    595576                schema = self.Schema() 
    596                 oldBodyText = self.getBodyText() 
    597577                for field in schema.editableFields(self): 
    598578                    if x.has_key(field.getName()): 
     
    600580                        self.getField(field.getName()).set(self, x[field.getName()]) 
    601581                self.storeInHistory(changedFields) 
    602                 self.correctReferences(oldBodyText, self.getBodyText())         
    603582        if self.portal_type in MATERIAL_TYPES: 
    604583            return self.REQUEST.RESPONSE.redirect('%s/view' % self.absolute_url()) 
Note: See TracChangeset for help on using the changeset viewer.