[Checkins] SVN: zope.app.publication/trunk/ - Use ``zope.browser.interfaces.ISystemError`` to avoid dependency on ``zope.app.exception``.
Michael Howitz
mh at gocept.com
Mon May 18 14:46:06 EDT 2009
Log message for revision 100089:
- Use ``zope.browser.interfaces.ISystemError`` to avoid dependency on ``zope.app.exception``.
- Refactored tests so they can run successfully with ZODB 3.8 and 3.9.
Changed:
U zope.app.publication/trunk/CHANGES.txt
U zope.app.publication/trunk/buildout.cfg
U zope.app.publication/trunk/setup.py
U zope.app.publication/trunk/src/zope/app/publication/tests/test_zopepublication.py
U zope.app.publication/trunk/src/zope/app/publication/zopepublication.py
-=-
Modified: zope.app.publication/trunk/CHANGES.txt
===================================================================
--- zope.app.publication/trunk/CHANGES.txt 2009-05-18 18:41:59 UTC (rev 100088)
+++ zope.app.publication/trunk/CHANGES.txt 2009-05-18 18:46:06 UTC (rev 100089)
@@ -2,15 +2,20 @@
CHANGES
=======
-3.5.4 (unreleased)
+3.6.0 (unreleased)
------------------
-- Use zope:adpater ZCML directive instead of zope:view.
- This avoid dependency on zope.app.component
+- Use ``zope:adpater`` ZCML directive instead of ``zope:view``.
+ This avoid dependency on ``zope.app.component``.
-- Update imports from zope.app.security to zope.authentication and
- zope.principalregistry.
+- Update imports from ``zope.app.security`` to ``zope.authentication`` and
+ ``zope.principalregistry``.
+- Use ``zope.browser.interfaces.ISystemError`` to avoid dependency on
+ ``zope.app.exception``.
+
+- Refactored tests so they can run successfully with ZODB 3.8 and 3.9.
+
3.5.3 (2009-03-13)
------------------
Modified: zope.app.publication/trunk/buildout.cfg
===================================================================
--- zope.app.publication/trunk/buildout.cfg 2009-05-18 18:41:59 UTC (rev 100088)
+++ zope.app.publication/trunk/buildout.cfg 2009-05-18 18:46:06 UTC (rev 100089)
@@ -1,12 +1,7 @@
[buildout]
develop = .
parts = test
-versions = versions
[test]
recipe = zc.recipe.testrunner
eggs = zope.app.publication [test]
-
-[versions]
-# This version is needed so the DemoStorage has undoInfo().
-ZODB3 = 3.8.1
Modified: zope.app.publication/trunk/setup.py
===================================================================
--- zope.app.publication/trunk/setup.py 2009-05-18 18:41:59 UTC (rev 100088)
+++ zope.app.publication/trunk/setup.py 2009-05-18 18:46:06 UTC (rev 100089)
@@ -21,8 +21,10 @@
def read(*rnames):
return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
+version = '3.6.0dev',
+
setup(name='zope.app.publication',
- version = '3.5.4dev',
+ version=version,
author='Zope Corporation and Contributors',
author_email='zope-dev at zope.org',
description='Zope publication',
@@ -50,7 +52,7 @@
extras_require = dict(
test=['zope.app.testing',
'zope.app.securitypolicy',
- 'zope.app.zcmlfiles',
+ 'zope.app.zcmlfiles>=3.5.4',
'zope.app.dav',
'zope.app.zptpage',
'zope.principalregistry',
@@ -63,7 +65,7 @@
'zope.i18n',
'zope.app.http',
'zope.app.applicationcontrol',
- 'zope.app.exception',
+ 'zope.browser>=1.2',
'zope.app.publisher',
'setuptools',
],
Modified: zope.app.publication/trunk/src/zope/app/publication/tests/test_zopepublication.py
===================================================================
--- zope.app.publication/trunk/src/zope/app/publication/tests/test_zopepublication.py 2009-05-18 18:41:59 UTC (rev 100088)
+++ zope.app.publication/trunk/src/zope/app/publication/tests/test_zopepublication.py 2009-05-18 18:46:06 UTC (rev 100089)
@@ -268,7 +268,7 @@
type=self.presentation_type)
view_text = 'You had a conflict error'
- from zope.app.exception.interfaces import ISystemErrorView
+ from zope.browser.interfaces import ISystemErrorView
class MyView:
implements(ISystemErrorView)
def __init__(self, context, request):
@@ -394,7 +394,7 @@
class FooError(Exception):
pass
- last_txn_info = self.storage.undoInfo()[0]
+ last_txn_info = self.storage.lastTransaction()
try:
raise FooError
except FooError:
@@ -403,7 +403,7 @@
self.object, self.request, sys.exc_info(), retry_allowed=False)
# assert that the last transaction is NOT our transaction
- new_txn_info = self.storage.undoInfo()[0]
+ new_txn_info = self.storage.lastTransaction()
self.assertEqual(last_txn_info, new_txn_info)
# instead, we expect a message in our logging utility
@@ -486,10 +486,10 @@
# we just need a change in the database to make the
# transaction notable in the undo log
root['foo'] = object()
- last_txn_info = self.storage.undoInfo()[0]
+ last_txn_info = self.storage.lastTransaction()
self.publication.afterCall(self.request, self.object)
self.assert_(txn is not transaction.get())
- new_txn_info = self.storage.undoInfo()[0]
+ new_txn_info = self.storage.lastTransaction()
self.failIfEqual(last_txn_info, new_txn_info)
def testDoomedTransaction(self):
@@ -499,13 +499,13 @@
# we just need a change in the database to make the
# transaction notable in the undo log
root['foo'] = object()
- last_txn_info = self.storage.undoInfo()[0]
+ last_txn_info = self.storage.lastTransaction()
# doom the transaction
txn.doom()
self.publication.afterCall(self.request, self.object)
# assert that we get a new transaction
self.assert_(txn is not transaction.get())
- new_txn_info = self.storage.undoInfo()[0]
+ new_txn_info = self.storage.lastTransaction()
# No transaction should be committed
self.assertEqual(last_txn_info, new_txn_info)
@@ -518,6 +518,19 @@
ztapi.provideAdapter(ILocation, IPhysicallyLocatable,
LocationPhysicallyLocatable)
+ def get_txn_info():
+ if hasattr(self.storage, 'iterator'):
+ # ZODB 3.9
+ txn_id = self.storage.lastTransaction()
+ txn = list(self.storage.iterator(txn_id, txn_id))[0]
+ txn_info = dict(location=txn.extension['location'],
+ user_name=txn.user,
+ request_type=txn.extension['request_type'])
+ else:
+ # ZODB 3.8
+ txn_info = self.storage.undoInfo()[0]
+ return txn_info
+
root = self.db.open().root()
root['foo'] = foo = LocatableObject()
root['bar'] = bar = LocatableObject()
@@ -533,7 +546,7 @@
expected_request = IRequest.__module__ + '.' + IRequest.getName()
self.publication.afterCall(self.request, bar)
- txn_info = self.storage.undoInfo()[0]
+ txn_info = get_txn_info()
self.assertEqual(txn_info['location'], expected_path)
self.assertEqual(txn_info['user_name'], expected_user)
self.assertEqual(txn_info['request_type'], expected_request)
@@ -541,6 +554,7 @@
# also, assert that we still get the right location when
# passing an instance method as object.
self.publication.afterCall(self.request, bar.foo)
+ txn_info = get_txn_info()
self.assertEqual(txn_info['location'], expected_path)
def testSiteEvents(self):
Modified: zope.app.publication/trunk/src/zope/app/publication/zopepublication.py
===================================================================
--- zope.app.publication/trunk/src/zope/app/publication/zopepublication.py 2009-05-18 18:41:59 UTC (rev 100088)
+++ zope.app.publication/trunk/src/zope/app/publication/zopepublication.py 2009-05-18 18:46:06 UTC (rev 100089)
@@ -41,7 +41,7 @@
import zope.authentication.interfaces
from zope.app.applicationcontrol.applicationcontrol \
import applicationControllerRoot
-from zope.app.exception.interfaces import ISystemErrorView
+from zope.browser.interfaces import ISystemErrorView
from zope.app.publication.interfaces import BeforeTraverseEvent
from zope.app.publication.interfaces import EndRequestEvent
from zope.app.publication.publicationtraverse import PublicationTraverse
More information about the Checkins
mailing list