[z3-checkins] r18099 - in z3/Five/branch/tziade_transaction: . bbb
tests
tziade at codespeak.net
tziade at codespeak.net
Mon Oct 3 12:26:37 CEST 2005
Author: tziade
Date: Mon Oct 3 12:26:33 2005
New Revision: 18099
Added:
z3/Five/branch/tziade_transaction/bbb/transaction_patch.py
z3/Five/branch/tziade_transaction/tests/test_import_conflicts.py
Removed:
z3/Five/branch/tziade_transaction/bbb/transaction.py
Modified:
z3/Five/branch/tziade_transaction/monkey.py
Log:
preventing Five from hiding zope 3 transaction module
Deleted: /z3/Five/branch/tziade_transaction/bbb/transaction.py
==============================================================================
--- /z3/Five/branch/tziade_transaction/bbb/transaction.py Mon Oct 3 12:26:33 2005
+++ (empty file)
@@ -1,27 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004, 2005 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""Transaction legacy package.
-
-$Id$
-"""
-def begin():
- get_transaction().begin()
-
-def commit(sub=False):
- get_transaction().commit(sub)
-
-def abort(sub=False):
- get_transaction().abort(sub)
-
-get_transaction = get = get_transaction
Added: z3/Five/branch/tziade_transaction/bbb/transaction_patch.py
==============================================================================
--- (empty file)
+++ z3/Five/branch/tziade_transaction/bbb/transaction_patch.py Mon Oct 3 12:26:33 2005
@@ -0,0 +1,27 @@
+##############################################################################
+#
+# Copyright (c) 2004, 2005 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Transaction legacy package.
+
+$Id$
+"""
+def begin():
+ get_transaction().begin()
+
+def commit(sub=False):
+ get_transaction().commit(sub)
+
+def abort(sub=False):
+ get_transaction().abort(sub)
+
+get_transaction = get = get_transaction
Modified: z3/Five/branch/tziade_transaction/monkey.py
==============================================================================
--- z3/Five/branch/tziade_transaction/monkey.py (original)
+++ z3/Five/branch/tziade_transaction/monkey.py Mon Oct 3 12:26:33 2005
@@ -53,5 +53,10 @@
import Zope2
except ImportError:
import sys
- from Products.Five.bbb import transaction
- sys.modules['transaction'] = transaction
+ import transaction
+ from Products.Five.bbb import transaction_patch
+ transaction.begin = transaction_patch.begin
+ transaction.commit = transaction_patch.commit
+ transaction.abort = transaction_patch.abort
+ transaction.get_transaction = transaction_patch.get_transaction
+ transaction.get = transaction_patch.get
Added: z3/Five/branch/tziade_transaction/tests/test_import_conflicts.py
==============================================================================
--- (empty file)
+++ z3/Five/branch/tziade_transaction/tests/test_import_conflicts.py Mon Oct 3 12:26:33 2005
@@ -0,0 +1,42 @@
+##############################################################################
+#
+# Copyright (c) 2004, 2005 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Unit tests for the viewable module.
+
+$Id: $
+"""
+import os, sys
+if __name__ == '__main__':
+ execfile(os.path.join(sys.path[0], 'framework.py'))
+
+def test_defaultView():
+ """
+ Under a Five environment, importing zope3
+ packages that would use zope 3 transaction module
+ would lead to an error, because of the monkey patching
+
+ >>> from zope.app.tests.placelesssetup import setUp, tearDown
+ >>> setUp()
+ >>> from zope.app.mail.delivery import QueueProcessorThread
+
+ Clean up:
+
+ >>> tearDown()
+ """
+
+def test_suite():
+ from Testing.ZopeTestCase import ZopeDocTestSuite
+ return ZopeDocTestSuite()
+
+if __name__ == '__main__':
+ framework()
More information about the z3-checkins
mailing list