[Zope-dev] Odd behavior of undoable_transactions()
Florent Guillaume
fg at nuxeo.com
Sun Mar 13 12:57:28 EST 2005
You're right. Please put it in the collector. The prefixes should indeed
be matching only at '/' boundaries.
Florent
Paul Winkler <pw_lists at slinkp.com> wrote:
> 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
--
Florent Guillaume, Nuxeo (Paris, France) CTO, Director of R&D
+33 1 40 33 71 59 http://nuxeo.com fg at nuxeo.com
More information about the Zope-Dev
mailing list