Commit 207a15c2 authored by Martijn Pieters's avatar Martijn Pieters

Fix for Collector #1810: A previous bugfix (#1726) broke listing undoable

transactions for users defined in a non-root acl_users folder. Zope logs a
acl_users path together with a username (separated by a space) and this
previous fix failed to take this into account. Fixed by taking anything after
the last space in the compared path out of the equation.
parent 17b317b3
......@@ -54,6 +54,14 @@ BTrees
from, or apply their update() methods to, a PersistentMapping or
PersistentDict. This works now.
ZopeUndo
--------
- (3.6a4) Collector 1810. A previous bugfix (#1726) broke listing undoable
transactions for users defined in a non-root acl_users folder. Zope logs
a acl_users path together with a username (separated by a space) and this
previous fix failed to take this into account.
Development
-----------
......
......@@ -39,6 +39,10 @@ class Prefix:
def __cmp__(self, o):
other_path = o.split('/')
if other_path and ' ' in other_path[-1]:
# don't include logged username in comparison
pos = other_path[-1].rfind(' ')
other_path[-1] = other_path[-1][:pos]
return cmp(other_path[:self.length], self.path)
def __repr__(self):
......
......@@ -28,5 +28,19 @@ class PrefixTest(unittest.TestCase):
for equal in ("", "/", "/def", "/a/b", "/a/b/c", "/a/b/c/d"):
self.assertEqual(p2, equal)
def test_username_info(self):
# Zope Collector 1810; user paths have username appended
p1 = Prefix('/a/b')
for equal in ('/a/b spam', '/a/b/c spam', '/a/b/c/b spam'):
self.assertEqual(p1, equal)
for notEqual in (" spam", "/a/c spam", "/a/bbb spam", "/// spam"):
self.assertNotEqual(p1, notEqual)
p2 = Prefix("")
for equal in (" eggs", "/ eggs", "/def eggs", "/a/b eggs",
"/a/b/c eggs", "/a/b/c/d eggs"):
self.assertEqual(p2, equal)
def test_suite():
return unittest.makeSuite(PrefixTest)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment