[ZCM] [ZC] 1726/ 2 Resolve "Undo log shows transactions in the wrong folder"

Collector: Zope Bugs, Features, and Patches ... zope-coders-admin at zope.org
Wed Mar 30 02:46:38 EST 2005


Issue #1726 Update (Resolve) "Undo log shows transactions in the wrong folder"
 Status Resolved, Zope/bug+solution low
To followup, visit:
  http://www.zope.org/Collectors/Zope/1726

==============================================================
= Resolve - Entry #2 by slinkp on Mar 30, 2005 2:46 am

 Status: Accepted => Resolved

Fixed in svn on the slinkp_1726_zopeundo branch, and merged to the trunk; also copied to the 2_7 branch in CVS.
________________________________________
= Request - Entry #1 by slinkp on Mar 15, 2005 2:43 pm

 Status: Pending => Accepted

 Supporters added: slinkp

If I have a folder /foo and another folder /foobar,                             
transactions for /foobar are displayed in                                       
foo.undoable_transactions(). 

This is almost certainly caused by lib/python/ZopeUndo/Prefix.py.                        
Prefix only cares if one string starts with the other, nothing more.
But this is intended purely for use in Zope, and we really care about paths, not raw strings.

Something like (untested):                                                      
                                                                                
>class Prefix:                                                               
>    """A Prefix() is equal to any path string it is a prefix of.
                                                                                >
>    Two Prefixes can not be compared.                                           
>    """                                                                         
                                                                                >
>    __no_side_effects__ = 1 # what's this mean anyway?                          
                                                                                >
>    def __init__(self, path):                                                   
>        path_as_list = path.split('/')                                          
>        self.length = len(path_as_list)                                         
>        self.path = path_as_list
>
>    def __cmp__(self, other):                                                       
>        other_path = other.split('/')                                               
>        return cmp(other_path[:self.length], self.path)

If there are no objections, I'll write tests and check it in on the trunk (svn) and then backport to the 2_7 branch in cvs.
==============================================================



More information about the Zope-Collector-Monitor mailing list