[Zope3-checkins] SVN: Zope3/branches/3.2/src/zope/app/undo/ Merge
from 3.3 branch (only partially because of different test setup):
Philipp von Weitershausen
philikon at philikon.de
Sun Jul 2 08:08:02 EDT 2006
Log message for revision 68944:
Merge from 3.3 branch (only partially because of different test setup):
Log message for revision 68942:
Fix #529: Undo Principal Transactions doesn't work with non-root principals
Changed:
U Zope3/branches/3.2/src/zope/app/undo/__init__.py
U Zope3/branches/3.2/src/zope/app/undo/tests/test_zodbundomanager.py
-=-
Modified: Zope3/branches/3.2/src/zope/app/undo/__init__.py
===================================================================
--- Zope3/branches/3.2/src/zope/app/undo/__init__.py 2006-07-02 10:32:50 UTC (rev 68943)
+++ Zope3/branches/3.2/src/zope/app/undo/__init__.py 2006-07-02 12:08:01 UTC (rev 68944)
@@ -27,7 +27,7 @@
from zope.app.undo.interfaces import IUndoManager, UndoError
from zope.app.traversing.interfaces import IPhysicallyLocatable
from zope.app.security.principalregistry import principalRegistry
-from zope.app.security.interfaces import IPrincipal
+from zope.app.security.interfaces import IAuthentication, IPrincipal
# BBB Backward Compatibility (Can go away in 3.3)
zope.deprecation.__show__.off()
@@ -153,19 +153,19 @@
user_name = split[1]
if user_name:
try:
- entry['principal'] = principalRegistry.getPrincipal(
- user_name)
+ principal = zope.component.getUtility(
+ IAuthentication).getPrincipal(user_name)
+ entry['principal'] = principal
except PrincipalLookupError:
# principals might have passed away
pass
except NotFoundError: # BBB Backward Compatibility
warnings.warn(
- "A %s instance raised a NotFoundError in "
+ "An authentication utility raised a NotFoundError in "
"getPrincipals. Raising NotFoundError in this "
"method is deprecated and will no-longer be supported "
"staring in Zope 3.3. PrincipalLookupError should "
- "be raised instead."
- % principalRegistry.__class__.__name__,
+ "be raised instead.",
DeprecationWarning)
return entries
@@ -186,7 +186,8 @@
txns = self._getUndoInfo(None, principal, first, -batch_size)
while txns and left_overs:
for info in txns:
- if info['id'] in left_overs and info['principal'] is principal:
+ if (info['id'] in left_overs and
+ info['principal'].id == principal.id):
left_overs.remove(info['id'])
first += batch_size
txns = self._getUndoInfo(None, principal, first, -batch_size)
Modified: Zope3/branches/3.2/src/zope/app/undo/tests/test_zodbundomanager.py
===================================================================
--- Zope3/branches/3.2/src/zope/app/undo/tests/test_zodbundomanager.py 2006-07-02 10:32:50 UTC (rev 68943)
+++ Zope3/branches/3.2/src/zope/app/undo/tests/test_zodbundomanager.py 2006-07-02 12:08:01 UTC (rev 68944)
@@ -22,6 +22,7 @@
from zope.testing.cleanup import CleanUp
from zope.app.testing import ztapi
from zope.app.testing.placelesssetup import PlacelessSetup
+from zope.app.security.interfaces import IAuthentication
from zope.app.undo import ZODBUndoManager
from zope.app.undo.interfaces import UndoError
@@ -94,6 +95,7 @@
principalRegistry.definePrincipal('jim', 'Jim Fulton', login='jim')
principalRegistry.definePrincipal('anthony', 'Anthony Baxter',
login='anthony')
+ ztapi.provideUtility(IAuthentication, principalRegistry)
self.undo = ZODBUndoManager(StubDB())
self.data = list(testdata)
More information about the Zope3-Checkins
mailing list