Is anyone but me bothered by this behavior of undoable_transactions()?
If I have a folder /foo and another folder /foobar,
transactions for /foobar are displayed in 
foo.undoable_transactions().

This is clearly caused by lib/python/ZopeUndo/Prefix.py.
The behavior matches the docstring - Prefix only cares
if one string starts with the other, nothing more.
But is that really desirable?
Since this is intended purely for use in Zope, wouldn't it
be more useful if it cared about paths as such?

Something like (untested):

class PathPrefix:
    """A PathPrefix() 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, o):
        other_path = o.split('/')
        rval = cmp(other[:self.length], self.path)
        return rval


-- 

Paul Winkler
http://www.slinkp.com
_______________________________________________
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )

Reply via email to