[Zodb-checkins] SVN: ZODB/trunk/ Fix for Collector #1810: A
previous bugfix (#1726) broke listing undoable
Martijn Pieters
mj at zopatista.com
Sun Sep 25 18:27:37 EDT 2005
Log message for revision 38631:
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.
Changed:
U ZODB/trunk/NEWS.txt
U ZODB/trunk/src/ZopeUndo/Prefix.py
U ZODB/trunk/src/ZopeUndo/tests/testPrefix.py
-=-
Modified: ZODB/trunk/NEWS.txt
===================================================================
--- ZODB/trunk/NEWS.txt 2005-09-25 21:05:15 UTC (rev 38630)
+++ ZODB/trunk/NEWS.txt 2005-09-25 22:27:36 UTC (rev 38631)
@@ -54,6 +54,14 @@
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
-----------
Modified: ZODB/trunk/src/ZopeUndo/Prefix.py
===================================================================
--- ZODB/trunk/src/ZopeUndo/Prefix.py 2005-09-25 21:05:15 UTC (rev 38630)
+++ ZODB/trunk/src/ZopeUndo/Prefix.py 2005-09-25 22:27:36 UTC (rev 38631)
@@ -39,6 +39,10 @@
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):
Modified: ZODB/trunk/src/ZopeUndo/tests/testPrefix.py
===================================================================
--- ZODB/trunk/src/ZopeUndo/tests/testPrefix.py 2005-09-25 21:05:15 UTC (rev 38630)
+++ ZODB/trunk/src/ZopeUndo/tests/testPrefix.py 2005-09-25 22:27:36 UTC (rev 38631)
@@ -28,5 +28,19 @@
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)
More information about the Zodb-checkins
mailing list