Commit 02f7065e 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 758e8a58
...@@ -54,6 +54,14 @@ BTrees ...@@ -54,6 +54,14 @@ BTrees
from, or apply their update() methods to, a PersistentMapping or from, or apply their update() methods to, a PersistentMapping or
PersistentDict. This works now. 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 Development
----------- -----------
......
...@@ -39,6 +39,10 @@ class Prefix: ...@@ -39,6 +39,10 @@ class Prefix:
def __cmp__(self, o): def __cmp__(self, o):
other_path = o.split('/') 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) return cmp(other_path[:self.length], self.path)
def __repr__(self): def __repr__(self):
......
...@@ -28,5 +28,19 @@ class PrefixTest(unittest.TestCase): ...@@ -28,5 +28,19 @@ class PrefixTest(unittest.TestCase):
for equal in ("", "/", "/def", "/a/b", "/a/b/c", "/a/b/c/d"): for equal in ("", "/", "/def", "/a/b", "/a/b/c", "/a/b/c/d"):
self.assertEqual(p2, equal) 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(): def test_suite():
return unittest.makeSuite(PrefixTest) 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